Gzip.py

Tim Peters tim_one at email.msn.com
Wed Jun 2 03:20:14 CEST 1999


> >>>>> "MC" == Matej Cepl <Cepl at fpm.cz> writes:
>
>   MC> Hi, I tried to play with gzip.py and it doesn't seem to
>   MC> work. Enclosed module produced output which Windows Commander as
>   MC> well as gzip refused to accept as correct gzip archive.

[Jeremy Hylton]
> I created my own file, fre-en_2.htm, and ran your script.  It worked
> correctly; gzip uncompressed it.  What exactly was your problem? Can
> you send me a copy of the .gz file produced?

The script opened the gzip file for output in text mode, and Matej was
running on Windows.  Replacing 'w' with 'wb' fixed it.

if-re.search('[Ww](in)?9[58]|indow)|NT|DOS')-and-
    re.search('(read|write)\(')-and-
    re.search("""['"][rw]['"]"""):-
    print-"try binary mode"-ly y'rs  -
    timbot's first and still most useful pattern






More information about the Python-list mailing list