Why can't I store a DLL in a module library Zip file?

Uberman bhood37 at hotmail.com
Fri Jan 9 18:50:26 EST 2009


I'm using Python 2.5.1, and I'm trying to use the module library as a Zip file
(for example, with python25_d.dll, the module library file would be called
python25_d.zip).  This works for the basic modules that come with Python (os,
sys, site, etc.), and it even seems to work when I place my own Python-based
modules within the Zip file (e.g., my_module.py).  My Python modules are found
within the library Zip file.

However, my Python module is dependent upon a SWIG-generated shared library,
which also has it's own Python module.  When placed into the Zip file, the
SWIG Python module is found, but the shared library file (the compiled C
shared library) is not.  I've stepped through the Python code to try and see
what's happening, but when it comes to looking in the Zip file
(python25_d.zip) for this shared library (*.pyd), it won't find it.

When I place all the files in the same folder as the executable (outside the
python25_d.zip) file, they are found by the run-time system, and everything is
happy.  I've also tried a properly constructed 'site-package' within the Zip
file, with the SWIG-generated files contained within, but that doesn't work
either.  It's almost like shared libraries are disallowed from the module
library Zip format.

Is there a trick, or some special location where it needs to be placed?  Any
help with this would be appreciated.  Thanks.



More information about the Python-list mailing list