look further down sys.path for extension module

Vincent Wehren vincent at visualtrans.de
Wed Oct 27 17:01:09 CEST 2004


Is it possible to have Python look further down sys.path for a C
extension module when an ImportError is raised because of the "dynamic
module not implementing init function"?

The thing is, I have a case where the cwd of an application that embedds
the Python interpreter needs to be inserted into sys.path at index. For
the windows version there is a zlib.dll in the app's directory, which -
naturally - gets "import precedence" over zlib.pyd from the DLLs
directory. For the time being, I place copy zlib.pyd into he app's
directory to solve the problem, but it would be nice if there was a way
to avoid having to do this.

Any thoughts much appreciated.
Vincent Wehren

More information about the Python-list mailing list