Discussion:
[Python.NET] ImportError: dynamic module does not define init function (initclr)
Vinke, Johan
2014-01-08 20:09:10 UTC
Permalink
I tried to get PythonNet working on a Windows 7 machine with Python 2.6.6 installed. My test program is very simple:

print "before import of clr"
import clr
print "done importing clr"


When I run the above in Pythonwin, I get this error:

ImportError: dynamic module does not define init function (initclr)

I have these packages installed (names of the installers are listed here):

python-2.6.6.msi (we must use 2.6 because of an application dependency --> Aveva Marine)
pywin32-214.win32-py2.6.exe
wxPython2.8-win32-ansi-2.8.9.2-py26.exe (and we must use wx......ansi-2.8.9.2..... because it's the only one that works in Aveva Marine 12.1.4)

I retrieved this zip file from the PythonNet site (on sourceforge):

pythonnet-2.0-alpha2-136-py26.zip

And unzipped it and placed the contents of the UCS2 sub-directory (except for the python.exe) in the C:\python26 directory. (Including the clr.pyd and the Python.Runtime.dll). The simple test program I have above is also in the C:\python26 directory. And the PYTHONPATH environment variable contains C:\python26 (and a few other folders/directories).

But I can't even get the first real statement - import clr - to work.

I apologize if this ends up being a complete newbie question.

If you have any ideas on what I'm missing, I would be extremely grateful.

Johan Vinke
GD-Nassco

Loading...