473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

zlib and zipfile module in Python2.4

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
3 3725
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LC | last post by:
Hi, I'm having a problem using the zipfile module in Windows 2000 sp4. When I use it to zip a small file it works fine, but large file doesnt. Here's the error msg i get......
1
by: Waitman Gobble | last post by:
Hello, I am new to Python. I am having trouble with zipfile.py. On a Linux machine with python 2.4.2 I have trouble opening a zipfile. Python is complaining about the bit where it does a...
5
by: OriginalBrownster | last post by:
This will probably sound like a very dumb question. I am trying to zip some files within a directory. I want to zip all the files within a directory called "temp" and have the zip archive...
2
by: metaperl | last post by:
I've tried both Python 2.4.4 and Python 2.5. I'm trying to build from source and install under a local directory Swarm since OpenSwarm requires builds of Postgres and Python under it's control. ...
4
by: shamzz | last post by:
Hi, I've compiled (configure/make/make install) Python 2.4.4 from source on Suse Linux Enterprise Server 9 (x64). I need Python to be compiled with Zlib so that I can compile and use Zope. ...
8
by: =?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B | last post by:
I made a C/S network program, the client receive the zip file from the server, and read the data into a variable. how could I process the zipfile directly without saving it into file. In the...
3
by: stuntgoat | last post by:
import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. I am trying to compile MySQLdb. any...
5
by: Neil Crighton | last post by:
I'm using the zipfile library to read a zip file in Windows, and it seems to be adding too many newlines to extracted files. I've found that for extracted text-encoded files, removing all instances...
1
by: John Machin | last post by:
On Jun 4, 8:06 pm, jwesonga <crazylun...@gmail.comwrote: Nothing is ever as it seems. Let's try to work backwards from the error message ... and we don't need your magnificent script, just the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.