[Python.NET] Python.NET and VS2010/.NET 4.0

Bart Jonkers jonkersbart at gmail.com
Tue Feb 8 11:33:36 CET 2011


Hi Oleskii,

Thanks for the quick response.

I searched on my system for the python26.dll and I found it in
C:\Windows\SysWOW64.
I copied it to c:\windows\system32\ and now I'm getting the following error:

Unhandled Exception: System.BadImageFormatException: An attempt was made to load
 a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at Python.Runtime.Runtime.Py_Initialize()
   at Python.Runtime.Runtime.Initialize()
   at Python.Runtime.PythonEngine.Initialize()
   at Python.Runtime.PythonConsole.Main(String[] args)

Anny idea?

I have installed python 2.6.6 (32-bit) on a 64-bit version of Windows 7.

The problem that we have with the .NET version of python.exe is that
it takes some time before it starts.
As we use python in our build environment, it significantly slows down
our build process.

Regards,
Bart

On Tue, Feb 8, 2011 at 11:08 AM, Oleksii Bidiuk
<oleksii.bidiuk at gmail.com> wrote:
> Hi Bart,
> the python26.dll is installed to the c:\windows\system32\ folder regardless
> of where your main Python installation goes to. I've seen similar problem
> when I have copied the Python26 folder to a new machine and forgot to take
> the python26.dll along. Check if you have the python26.dll in place and make
> sure you use the newly built python.exe interpreter.
>
> It is indeed recommended to use the python.exe compiled with PythonNET as it
> does some additional initialization (see the implementation of the
> Initialize() method in pythonengine.cs code).
> 2011/2/8 Bart Jonkers <jonkersbart at gmail.com>
>>
>> Hi,
>>
>> I followed the instructions from oleskii to build Python.NET for .NET4.0.
>> Compilation wend fine but when I try to run python.exe I get the
>> following error:
>>
>> Unhandled Exception: System.DllNotFoundException: Unable to load DLL
>> 'python26':
>>  The specified module could not be found. (Exception from HRESULT:
>> 0x8007007E)
>>   at Python.Runtime.Runtime.Py_Initialize()
>>   at Python.Runtime.Runtime.Initialize()
>>   at Python.Runtime.PythonEngine.Initialize()
>>   at Python.Runtime.PythonConsole.Main(String[] args)
>>
>> I have installed Python in C:\Python26.
>> Does any one an idea?
>>
>> Is it necessary to use the python.exe build by the project or is it
>> also possible to use the original python executable?
>> When I try to use the original python executable I get the following
>> error:
>> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
>> (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import clr
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>> SystemError: dynamic module not initialized properly
>> >>>
>>
>> Regards,
>> Bart
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> http://mail.python.org/mailman/listinfo/pythondotnet
>
>
>
> --
> oleksii
>


More information about the PythonDotNet mailing list