gzip.py failure

Gerhard Häring gerhard.nospam at bigfoot.de
Sat Jun 16 12:11:57 EDT 2001


On Sat, 16 Jun 2001 16:38:57 GMT, John Weeks <jhweeks at earthlink.net> wrote:
>I'm running Python 2.0 from the SuSE 7.1 distribution.
>
>I'm getting an attribute error when trying to umcompress a gziped file. The 
>error occurs on line 210 of the gzip.py module:
>
>      if self.decompress.unused_data != "":
>
>There doesn't seem to be an "unused_data" attribute for the "decompress" 
>object.
>
>Running this program:
>
>   from gzip import *
>   def gf():
>        f=GzipFile("g.data","r")
>        c=f.read()
>        print c
>
>   gf()
>
>produces the following:
>
> Traceback (most recent call last):
>  File "tt.py", line 7, in ?
>    gf()
>  File "tt.py", line 4, in gf
>    c=f.read()
>  File "/usr/lib/python2.0/gzip.py", line 149, in read
>    self._read(readsize)
>  File "/usr/lib/python2.0/gzip.py", line 210, in _read
>    if self.decompress.unused_data != "":
>  AttributeError: unused_data
>
>Anybody have any ideas?

On my second SuSE 7.1 machine I still have Python 2.0, so I tried there.

Let me guess! You have Zope installed? I knew 8-) I have had a similar problem,
and uninstalling Zope helped. Your test script runs fine w/o Zope, but crashes
w/ Zope installed on my machine.

Consider this:

gerhard at gargamel:/tmp > rpm -qf /usr/lib/python2.0/lib-dynload/zlibmodule.so
python-2.0-6
gerhard at gargamel:/tmp > rpm -qf /usr/lib/python2.0/lib-dynload/zlib.so
zope-2.2.5-0

Seems the Zope RPM installs a different zlib module and Python loads zlib.so
instead of zlibmodule.so

I'd recommend that, if you don't need Zope, throw it away, else try
deleting/renaming that zlib.so

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://highqualdev.com              public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list