[Python.NET] Setup sys.path in Embedded Application
Hi Everyone, I'm looking at embedding python in my .NET app. I was wondering what is the best practice for adding additional paths to the sys.path? I want the standard python sys path but additional paths for my own python scripts. Do I just Py.Import("sys") and then add it there or is there some other way? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] Setup sys.path in Embedded Application
Hi, Thanks for the input. I wanted my bootstrapper for my C# application to setup Python Engine but I guess I could create like a startup script that it calls to sys path and anything else I need to. Thanks. Danny To: pythondotnet@python.org From: mclaveau m...@mclaveau.com Date: Thu, 6 Aug 2015 10:38:44 +0200 Subject: Re: [Python.NET] Setup sys.path in Embedded Application Le 03.08.15 23:33, Daniel Fernandez a écrit : Hi Everyone, I’m looking at embedding python in my .NET app. I was wondering what is the best practice for adding additional paths to the sys.path? I want the standard python sys path but additional paths for my own python scripts. Do I just Py.Import(“sys”) and then add it there or is there some other way? Thanks. Danny Hi! Had you try : sys.path.append(myPathDir) at beginning of your scripts? @-salutations -- Michel Claveau _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
[Python.NET] Support for Python 3.5
Hi All, I was wondering when there will be a release for Python 3.5? I'm not sure if that is in the works. Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] Support for Python 3.5
It’s done created an issue, https://github.com/pythonnet/pythonnet/issues/103. From: PythonDotNet [mailto:pythondotnet-bounces+fernandez_dan2=hotmail@python.org] On Behalf Of Denis Akhiyarov Sent: Thursday, September 17, 2015 8:42 AM To: A list for users and developers of Python for .NET Subject: Re: [Python.NET] Support for Python 3.5 No one worked on this based on commits. The code needs to be updated with corresponding flag, not sure if Py34 will still work. But definitely wheels need to be generated for pypi. Feel free to open issue. On Thu, Sep 17, 2015, 9:15 AM Daniel Fernandez mailto:fernandez_d...@hotmail.com> > wrote: Hi All, I was wondering when there will be a release for Python 3.5? I’m not sure if that is in the works. Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org <mailto:PythonDotNet@python.org> https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
[Python.NET] Issue with beautifulsoup 4
Hey Everyone, I'm running into an issue importing beautifulsoup 4 only if I import clr before importing beautifulsoup. I'm using python 3.5 32-bit version on my Windows 7 and Windows 10 box. I'm using beautifulsoup package from Gohlke website (beautifulsoup4-4.4.1-py3-none-any.whl) I simply runimport clrfrom bs4 import beautifulsoup then I get this error Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) I build the pythonnet debug version I get this call stack Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) in pythonnet\src\runtime\moduleobject.cs:line 26 at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) in pythonnet\src\runtime\moduleobject.cs:line 101 at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 315 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 if I switch the lines of codefrom bs4 import Beautifulsoupimport clr no errors occur. Is anyone running into this issue? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] Issue with beautifulsoup 4
Hi All, I narrow down the issue to a relative import of html5lib. I see there is already a pull request (https://github.com/pythonnet/pythonnet/pull/219) that addresses this relative import issue chaning the importhook.cs. Thanks. Danny From: fernandez_d...@hotmail.com To: pythondotnet@python.org Date: Fri, 27 May 2016 22:02:14 -0600 Subject: [Python.NET] Issue with beautifulsoup 4 Hey Everyone, I'm running into an issue importing beautifulsoup 4 only if I import clr before importing beautifulsoup. I'm using python 3.5 32-bit version on my Windows 7 and Windows 10 box. I'm using beautifulsoup package from Gohlke website (beautifulsoup4-4.4.1-py3-none-any.whl) I simply runimport clrfrom bs4 import beautifulsoup then I get this error Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) I build the pythonnet debug version I get this call stack Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) in pythonnet\src\runtime\moduleobject.cs:line 26 at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) in pythonnet\src\runtime\moduleobject.cs:line 101 at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 315 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 if I switch the lines of codefrom bs4 import Beautifulsoupimport clr no errors occur. Is anyone running into this issue? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] Issue with beautifulsoup 4
Hi Denis, I just verified that this does fix the issue with the local import in this specific case. Any idea when the pull request will be accepted? Danny Date: Sat, 28 May 2016 11:55:28 -0500 From: denis.akhiya...@gmail.com To: pythondotnet@python.org Subject: Re: [Python.NET] Issue with beautifulsoup 4 There is pending pull request hopefully addressing this issue: https://github.com/pythonnet/pythonnet/pull/219 If not, then please open an issue on github or comment on that pull request. On Friday, May 27, 2016, Daniel Fernandez wrote: Hey Everyone, I'm running into an issue importing beautifulsoup 4 only if I import clr before importing beautifulsoup. I'm using python 3.5 32-bit version on my Windows 7 and Windows 10 box. I'm using beautifulsoup package from Gohlke website (beautifulsoup4-4.4.1-py3-none-any.whl) I simply runimport clrfrom bs4 import beautifulsoup then I get this error Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) I build the pythonnet debug version I get this call stack Unhandled Exception: System.ArgumentException: Name must not be empty! at Python.Runtime.ModuleObject..ctor(String name) in pythonnet\src\runtime\moduleobject.cs:line 26 at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) in pythonnet\src\runtime\moduleobject.cs:line 101 at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 315 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.ImportHook.__import__(IntPtr self, IntPtr args, IntPtr kw) in pythonnet\src\runtime\importhook.cs:line 237 if I switch the lines of codefrom bs4 import Beautifulsoupimport clr no errors occur. Is anyone running into this issue? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
[Python.NET] clr ImportError
Hi All, I was wondering if anyone has ran into this before. I have latest pythonnet installed and everything is working great. I have been using for the last couple of weeks with python 3.5.2 (32 bit) on Win 7 box. I decided to try out ptpython so I pip install it. Now I am getting a "ImportError: dynamic module does not define module export function (PyInit_clr)" error. I go back to the normal python repl window and the same error occurs. Has anyone seen this before and what's the best way to debug this? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] clr ImportError
Hi Denis, I was able to get it working on my side but I needed to execute import clr as the first command then my scripts. I will try the recommend path below and see what I can find out below. Thanks. Danny Date: Fri, 15 Jul 2016 02:37:43 -0500 From: denis.akhiya...@gmail.com To: pythondotnet@python.org Subject: Re: [Python.NET] clr ImportError I would start with clean installation of pythonnet wheel from PyPi or source on master branch on github, preferable in conda env or virtualenv. Also make sure you have no left-over clr.pyd or Python.Runtime.dll files in system or python paths. I used pt(i)python with no problems before. But what happens if you remove it completely? It is possible to debug this, but let's first find out if this is repeatable? The way I normally debug this initialization code is by checking Debugger.IsAttached and sleeping the thread if the flag is false. On Thursday, July 14, 2016, Daniel Fernandez wrote: Hi All, I was wondering if anyone has ran into this before. I have latest pythonnet installed and everything is working great. I have been using for the last couple of weeks with python 3.5.2 (32 bit) on Win 7 box. I decided to try out ptpython so I pip install it. Now I am getting a "ImportError: dynamic module does not define module export function (PyInit_clr)" error. I go back to the normal python repl window and the same error occurs. Has anyone seen this before and what's the best way to debug this? Thanks. Danny _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet
Re: [Python.NET] advanced book about Python
Hi Denis, I am interested. What do I need to do? I wasn't sure how much to contribute? Thanks. Danny From: denis.akhiya...@gmail.com Date: Thu, 13 Oct 2016 16:39:25 -0500 To: pythondotnet@python.org Subject: [Python.NET] advanced book about Python Hi Python and .NET developers, I would like to purchase a copy of this advanced book about Python for pythonnet contributors: https://thehackerguidetopython.com The cost of professional license to share with 50 people is 199 USD ($), but I will pay it in full if at least 10 people agree to contribute any amount towards the full cost. The book is sold for 29$ for one person. The author agreed to this deal. The author is OpenStack Project Team Leader and Technical Committee Member. Here is a sample chapter about functional programming, comprehensions, and generators: https://thehackerguidetopython.com/the-hacker-guide-to-python-sample.pdf Please reply to me or here if you would like to get this offer! Thanks,Denis _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet _ Python.NET mailing list - PythonDotNet@python.org https://mail.python.org/mailman/listinfo/pythondotnet