gzip.py failure

John Weeks jhweeks at earthlink.net
Sat Jun 16 17:40:13 EDT 2001


Gerhard Häring wrote:

> 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

Brilliant! You are exactly correct. I uninstalled zope and everything works 
the way it should. 

I was going to play with zope sometime, but when or if I need to I'll deal 
with the zlib problem.

Thanks,
JW
jhweeks at earthlink.net




More information about the Python-list mailing list