You're welcome. It sounds to me as if something that got installed in the other virtualenv broke the environment in some way that some of the system libraries couldn't be found.
Looking at the source code, it appears that error is generated here when this function returns NULL
. The reasons for this appear to be if the zip file you're importing contains a module called zlib
(which looks like it breaks the whole zipimport
infrastructure) or if the zlib
module can't be found. As far as I'm aware that module is compiled directly into the Python binary itself, however (I may be wrong!), so I'm quite puzzled why it can't be found. Also, if the zlib
module doesn't contain a decompress()
function that would also cause a problem, but that shouldn't happen either.
So, it's very puzzling. If you still have the old virtualenv around, you might like to check if you had a file zlib.py
or zlib.pyc
(or zlib.pyo
) around in it somewhere - it appears that will mess things up quite badly.
EDIT
As it happens I can't reproduce this even putting a zlib.py
and zlib.pyc
file into a zip archive with another library - I can still import the other library fine. Very odd. Well, the important thing is that it's working for you now, but it would be very interesting to know what caused the problem for future reference.