By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,526 Members | 1,618 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,526 IT Pros & Developers. It's quick & easy.

zlib and zipfile module in Python2.4

P: n/a
I was unable to use the ZipFile class in the zipfile module in Python2.4. I
got an error that zlib could not be found. Comparing my Python 2.2
installation I noticed Python 2.4 was missing a certain file:
/usr/lib/python2.2/lib-dynload/zlibmodule.so. Unable to find a more elegant
solution, I copied the file from my Python 2.2 directory into my Python 2.4
directory. When running my Python script it gives a warning:

/usr/local/lib/python2.4/zipfile.py:7: RuntimeWarning: Python C API version
mismatch for module zlib: This Python has C API version 1012, module zlib
has version 1011.
import zlib # We may need its compression method

But it works. Python 2.2 and 2.3 handle zipfiles out of the box. Could a
file have been omitted from Python 2.4 by accident?

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Alan Toppen wrote:
When running my Python script it gives a warning:

/usr/local/lib/python2.4/zipfile.py:7: RuntimeWarning: Python C API version mismatch for module zlib: This Python has C API version 1012, module zlib
has version 1011.
import zlib # We may need its compression method
that's usually a non-critical warning.
But it works. Python 2.2 and 2.3 handle zipfiles out of the box. Could a
file have been omitted from Python 2.4 by accident?


from your Python 2.4 build, perhaps.

Python 2.4 itself definitely supports zlib/zipfile. e.g.

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
import zlib
import zipfile


I suggest checking with whoever built Python for you.

</F>

Jul 18 '05 #2

P: n/a
On Mon, 11 Apr 2005 10:38:37 -0400, Alan Toppen wrote:
I was unable to use the ZipFile class in the zipfile module in
Python2.4. I got an error that zlib could not be found. Comparing my
Python 2.2 installation I noticed Python 2.4 was missing a certain file:
/usr/lib/python2.2/lib-dynload/zlibmodule.so. Unable to find a more
elegant solution, I copied the file from my Python 2.2 directory into my
Python 2.4 directory. When running my Python script it gives a warning:

/usr/local/lib/python2.4/zipfile.py:7: RuntimeWarning: Python C API
version mismatch for module zlib: This Python has C API version 1012,
module zlib has version 1011.
import zlib # We may need its compression method

But it works. Python 2.2 and 2.3 handle zipfiles out of the box. Could a
file have been omitted from Python 2.4 by accident?


If you built it you should check for the zlib development headers. If they
are not, zlib will not be built.

I recently had this issue and discovered that if zlib headers are not
there, python still builds gzip ... which imports zlib. Seems to me that
since zlib apparently depends on gzip, gzip should only be built if zlib
is.

Cheers,
Bill
Jul 18 '05 #3

P: n/a
Bill Anderson wrote:
I recently had this issue and discovered that if zlib headers are not
there, python still builds gzip ... which imports zlib. Seems to me that
since zlib apparently depends on gzip, gzip should only be built if zlib
is.


gzip is a Python module, and isn't "built".

if zlib isn't available, importing gzip gives you an ImportError exception. if you
remove gzip, you still get an ImportError exception. the only difference is that
the former message tells you exactly what module you need to add.

attempting to remove Python modules that may or may not work depending
on what other modules are available or not when you run the Python installation
scripts, in order to make the error message less informative, strikes me as some-
what silly.

</F>

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.