I’m using MinGW to build a PythonC module using Swig. When I tell Python to load the module, it fails and complains that Python cannot find the module.
The funny thing is that the module is in the same directory that I’m running Python in and the module is named _mod.pyd. (I also have generated a mod.py file that uses _mod.pyd in the same path.)
It’s frustrating like you wouldn’t believe!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mod.py", line 25, in <module>
_mod = swig_import_helper()
File "mod.py", line 21, in swig_import_helper
_mod = imp.load_module('_mod', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.
It builds cleanly (I’m using distutils) and all my dll’s are located in a directory that has been exposed to PATH.
I’m on a Windows XP+MinGW platform (latest stable MinGW).
Thanks!
This is a common problem. You probably are using the binary version of Python for Windows which is compiled with MSC not with MinGW. You can see it looking what the interpreter says when you run it from command line. If it is the case you have two choices:
For the latter option, well, good luck. I have never been able to do it.