3rd party python module with pyd picking up wrong dlls

Pix bigfatwhale at gmail.com
Thu Nov 4 17:00:44 EDT 2010


Hi,

I'm trying to install OpenSSL by placing it in site-packages\OpenSSL.
In the directory there the following files,

crypto.pyd
libeay32.dll
rand.pyd
SSL.pyd
ssleay32.dll

When i try to import the module by doing "import OpenSSL" i get an
import error saying "ImportError: DLL load failed: The specified
module could not be found". It turns out that there is another module
(call it XXX) that is install which contains different versions of
libeay32.dll and ssleay32.dll. And the path to the XXX appears earlier
in os.environ['PATH'] than the OpenSSL dir. So this cause it to pick
up the wrong dll which in turn causes the import error. If i renamed
the dlls in XXX's dir then the import will work fine.

So my question is, shouldn't the import be picking up the dlls in the
module directory first before following the PATH in it's search order?
Seem that is doesn't make sense because if i put OpenSSL earlier in
the path, it would work for OpenSSL, but then XXX will be picking up
the wrong dll.

Any help is much appreciated!

Regards,
Pix



More information about the Python-list mailing list