gzip module - help!

bmgz bmgz at dev.null
Sun Dec 14 04:15:04 EST 2003


I am having problems trying to use the gzip module, I do the followig

>>>import gzip
>>>file = gzip.GzipFile("testfile.txt")
>>>file.write() -which params does this accept?, archive name?

I get this ERROR:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/gzip.py", line 139, in write
    self.size = self.size + len(data)
AttributeError: GzipFile instance has no attribute 'size'


But if I include a mode in "gzip.GzipFile("testfile.txt", 'wb')" or
something like that I don't get an error
and then I manage to do >>>file.close() but still I can't find any
compressed file?








More information about the Python-list mailing list