gzip module - help!

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


Sorry, I forgot to mention that i am trying to create an archive.

"bmgz" <bmgz at dev.null> wrote in message news:3fdc2a06.0 at news1.mweb.co.za...
> 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