Discussion:
[Python.NET] Replaced Python.exe file causes problems for extension modules
Øystein Skotheim
2011-07-11 09:58:28 UTC
Permalink
Hello. I have managed to compile the SVN version of PythonDotNet against
the 4.0 version of the .NET library with Visual Studio 2010 on Windows
7. I copied over clr.pyd, Python.Runtime.dll as well as new versions of
python.exe and pythonw.exe into my C:\Python26 directory. I am now able
to import .NET 4.0 modules after writing "import clr" :-)

However, I have run into a few problems because I had to replace my
Python executable. I am using a lot of packages from the PythonXY that
depend on c extension modules (.pyd-files). Whenever I try to import
such a module, I get the following error:

Runtime Error!

Program: C:\Python26\Python.exe

R6034
An application has made an attempt to load the C runtime library
incorrectly.
Please contact the application's support team for more information.

I think the reason for this is that I have compiled Python.exe with
Visual Studio 2010, whereas the extension modules are compiled with
Visual Studio 2008 (i.e. my Python.exe is linked against msvcrt10.dll
while the extension modules are linked against msvcrt90.dll)

Is there any way I can prevent this error from happening without having
to recompile all the extension modules in my PythonXY distribution?

The other solution would be to keep my original "Python.exe" file, but
if I do that I get the following error message when I try to import the
CLR module:

In [1]: import clr
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
SystemError: dynamic module not initialized properly

Is there any way around this?

Cheers,

---
Øystein Skotheim
Research Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT, Trondheim, Norway
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet
Dave Hirschfeld
2011-07-11 10:34:31 UTC
Permalink
Post by Øystein Skotheim
Hello. I have managed to compile the SVN version of PythonDotNet against
the 4.0 version of the .NET library with Visual Studio 2010 on Windows
7. I copied over clr.pyd, Python.Runtime.dll as well as new versions of
python.exe and pythonw.exe into my C:\Python26 directory. I am now able
to import .NET 4.0 modules after writing "import clr"
However, I have run into a few problems because I had to replace my
Python executable. I am using a lot of packages from the PythonXY that
depend on c extension modules (.pyd-files). Whenever I try to import
Runtime Error!
Program: C:\Python26\Python.exe
<snip>
The other solution would be to keep my original "Python.exe" file, but
if I do that I get the following error message when I try to import the
In [1]: import clr
------------------------------------------------------------
File "<ipython console>", line 1, in <module>
SystemError: dynamic module not initialized properly
Is there any way around this?
Cheers,
---
Øystein Skotheim
Research Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT, Trondheim, Norway
Sounds like you may have forgotten to edit your buildclrmodule.bat file to
reference the .NET4 version of ilasm - see:

http://permalink.gmane.org/gmane.comp.python.dotnet/970

I don't know that copying over the newly compiled python.exe will work (possibly
for the reasons you state) however simply copying over the clr.pyd and
Python.Runtime.dll to your C:\Python26 directory should work if you make the
changes to the buildclrmodule.bat file.

HTH,
Dave


_________________________________________________
Python.NET mailing list - ***@python.org
h
Øystein Skotheim
2011-07-11 11:18:47 UTC
Permalink
Post by Dave Hirschfeld
Post by Øystein Skotheim
The other solution would be to keep my original "Python.exe" file, but
if I do that I get the following error message when I try to import the
In [1]: import clr
------------------------------------------------------------
File "<ipython console>", line 1, in<module>
SystemError: dynamic module not initialized properly
Is there any way around this?
Sounds like you may have forgotten to edit your buildclrmodule.bat file to
http://permalink.gmane.org/gmane.comp.python.dotnet/970
I don't know that copying over the newly compiled python.exe will work (possibly
for the reasons you state) however simply copying over the clr.pyd and
Python.Runtime.dll to your C:\Python26 directory should work if you make the
changes to the buildclrmodule.bat file.
Thanks a lot, Dave. After making the changes you suggested, it works to
import the clr module with the original Python.exe file :-)

Cheers,
---
Øystein Skotheim
Research Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT, Trondheim, Norway
_________________________________________________
Python.NET mailing list - ***@python.org
http://

Loading...