Discussion:
importing from .pyd
Kay Schluehr
2008-07-14 11:11:03 UTC
Permalink
hi
there is a .pyd file present in the same folder as the script abc.py
by the name foo.pyd .I don't have foo.py .In the script abc.py I try
import foo
Error i get is
ImportError: DLL load failed: The specified module could not be found.
It looks like the module that was accessed is either corrupt
( unavailable entry point ) or it contains dependencies to other
modules which are not available.

At least the latter can be checked without access to the source using
the DependencyWalker:

http://www.dependencywalker.com/

Notice that the message clearly indicates that Python found the module
but failed to load it i.e. performing a LoadLibrary() which yielded a
NULL pointer.
moijes12
2008-07-14 04:03:08 UTC
Permalink
hi

there is a .pyd file present in the same folder as the script abc.py
by the name foo.pyd .I don't have foo.py .In the script abc.py I try

import foo

Error i get is
ImportError: DLL load failed: The specified module could not be found.

I have tried placing .pyd under C:\python25\DLLs but it didn't work.I
have also given the path for foo.pyd in PYTHONPATH.but i still recieve
the same error.

Please suggest a solution

moijes12
moijes12
2008-08-29 12:17:16 UTC
Permalink
Post by Kay Schluehr
hi
there is a .pyd file present in the same folder as the script abc.py
by the name foo.pyd .I don't have foo.py .In the script abc.py I try
import foo
Error i get is
ImportError: DLL load failed: The specified module could not be found.
It looks like the module that was accessed is either corrupt
( unavailable entry point ) or it contains dependencies to other
modules which are not available.
At least the latter can be checked without access to the source using
http://www.dependencywalker.com/
Notice that the message clearly indicates that Python found the module
but failed to load it i.e. performing a LoadLibrary() which yielded a
NULL pointer.
thanks
John Machin
2008-08-29 14:15:09 UTC
Permalink
[snip]
Post by Kay Schluehr
Error i get is
ImportError: DLL load failed: The specified module could not be found.
Notice that the message clearly indicates that Python found the module
but failed to load it i.e. performing a LoadLibrary() which yielded a
NULL pointer.
"The specified module could not be found" clearly indicates that
"Python found the module"???

I suggest a more descriptive and (Monty) Pythonic error message: "I
found a foo.pyd which looks like a DLL but it contains no 'initfoo'
entrypoint therefore I throw an ImportError and a bucketful of pig
slops in your general direction."

Loading...