Hi, We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error: ImportError: dynamic module does not define init function (initclr) What magic does the included python.exe perform, or what are we doing wrong in our installation. We have tried: * copying Python.runtime.dll and clr.pyd to the python install path (where python.exe lives), or both to the DLLs directory, or clr.pyd to the site-packages directory and Python.runtime.dll to one of the above locations. * We've also tried having them in a separate directory, and running python.exe from that directory. (The readme is not very explanatory on how to modify an existing python installation). thanks for your help Paul & Tim
Hi, I ran into exactly the same problem as you but I did manage to solve it by recompiling the entire project in visual c# express. Unfortunately, I don't recall exactly what I did and I don't have my laptop handy right now, but I can find out later. In the meantime, you can try the recompile, and, to modify an existing installation, copy the .pyd file to C:\Python25\DLLs\ and the .dll file to C:\Python25\. Then it should "just work". Cheers, Feihong Paul Harter <paul@lumidium.com> wrote: Hi, We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error: ImportError: dynamic module does not define init function (initclr) What magic does the included python.exe perform, or what are we doing wrong in our installation. We have tried: * copying Python.runtime.dll and clr.pyd to the python install path (where python.exe lives), or both to the DLLs directory, or clr.pyd to the site-packages directory and Python.runtime.dll to one of the above locations. * We've also tried having them in a separate directory, and running python.exe from that directory. (The readme is not very explanatory on how to modify an existing python installation). thanks for your help Paul & Tim _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet --------------------------------- Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
I've had a similar experience. Out of the box binaries don't work unless included python.exe is used. A simple recompile of the code using VS C# express solved this. Also, attached is a slightly modified version of clrmodule.il that allows you to load clr.pyd and Python.Runtime.dll from any directory( as long as it's in pythonpath) Maksim ________________________________ From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org] On Behalf Of Feihong Hsu Sent: Monday, October 08, 2007 12:43 PM To: Paul Harter; pythondotnet@python.org Cc: tim@red56.co.uk Subject: Re: [Python.NET] python 2.5 Hi, I ran into exactly the same problem as you but I did manage to solve it by recompiling the entire project in visual c# express. Unfortunately, I don't recall exactly what I did and I don't have my laptop handy right now, but I can find out later. In the meantime, you can try the recompile, and, to modify an existing installation, copy the .pyd file to C:\Python25\DLLs\ and the .dll file to C:\Python25\. Then it should "just work". Cheers, Feihong Paul Harter <paul@lumidium.com> wrote: Hi, We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error: ImportError: dynamic module does not define init function (initclr) What magic does the included python.exe perform, or what are we doing wrong in our installation. We have tried: * copying Python.runtime.dll and clr.pyd to the python install path (where python.exe lives), or both to the DLLs directory, or clr.pyd to the site-packages directory and Python.runtime.dll to one of the above locations. * We've also tried having them in a separate directory, and running python.exe from that directory. (The readme is not very explanatory on how to modify an existing python installation). thanks for your help Paul & Tim _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet ________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: <http://us.rd.yahoo.com/evt=48253/*http:/mobile.yahoo.com/go?refer=1GNXI C> mail, news, photos & more.
Thanks for your help. It imports fine now. I will try out the clrmodule.il - that will be v useful. Paul
Paul Harter wrote:
Hi,
We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error:
ImportError: dynamic module does not define init function (initclr)
What magic does the included python.exe perform, or what are we doing wrong in our installation.
(Resending because gmane didn't send this msg) Oh, that's probably a bug in Mono. I haven't had a chance to test the pre-built package on Windows to its full extend. I used Mono to compile the assemblies and binaries. Python.exe and the assemblies worked like a charm on Windows but I forgot to see if clr.pyd works, too I'm going to investigate the problem and send a bug report to the mono developers. Can anybody please send me a Windows binary of clr.pyd? About embedding: Could you please release some sample code how to embed Python.NET and Python 2.x on Windows? I've just some C code for Mono. Christian
Paul Harter wrote:
Hi,
We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error:
ImportError: dynamic module does not define init function (initclr)
What magic does the included python.exe perform, or what are we doing wrong in our installation.
I got a reply to my bug report: https://bugzilla.novell.com/show_bug.cgi?id=334544#c4 --- Comment #4 from Paolo Molaro <lupus@novell.com> 2007-10-19 00:40:09 MST --- ilasm doesn't support unmanaged exports, that is exporting managed methods as unmanaged functions in a dll. This would be only useful on windows as other systems don't use PE files for shared libraries, so unless someone contributes the code this feature has no meaning in the mono context. Christian
y, this is known as windows-only. for mono we'd probably have to do a regular python C extension that uses the mono hosting apis to bootstrap the runtime. -Brian On 10/19/07 7:45 AM, "Christian Heimes" <lists@cheimes.de> wrote:
Paul Harter wrote:
Hi,
We are tring to move to python 2.5. and are having trouble getting pythonDotNet to import using the pre-built binaries. When we use the python.exe which is part of the pre-built binaries "import clr" can execute without a problem. However trying to use an existing python.exe (e.g. the standard installed one, but we also need to use it embedded) we always get the following error:
ImportError: dynamic module does not define init function (initclr)
What magic does the included python.exe perform, or what are we doing wrong in our installation.
I got a reply to my bug report:
https://bugzilla.novell.com/show_bug.cgi?id=334544#c4
--- Comment #4 from Paolo Molaro <lupus@novell.com> 2007-10-19 00:40:09 MST --- ilasm doesn't support unmanaged exports, that is exporting managed methods as unmanaged functions in a dll. This would be only useful on windows as other systems don't use PE files for shared libraries, so unless someone contributes the code this feature has no meaning in the mono context.
Christian
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
-------------------------- Brian Lloyd brian.lloyd@revolutionhealth.com
Brian Lloyd wrote:
y, this is known as windows-only. for mono we'd probably have to do a regular python C extension that uses the mono hosting apis to bootstrap the runtime.
It's already done. I've written the C extension couple of month ago to play with the Python C API and the Mono C API. So far it works and I haven't heard a single complain. See https://pythonnet.svn.sourceforge.net/svnroot/pythonnet/trunk/pythonnet/src/... Christian
participants (5)
-
Brian Lloyd -
Christian Heimes -
Feihong Hsu -
Maksim Kozyarchuk -
Paul Harter