zlib, gzip and HTTP compression.

Andrew MacIntyre andymac at bullseye.apana.org.au
Sat Jan 12 02:01:53 EST 2002


On 11 Jan 2002, Alan Kennedy wrote:

> There is obviously some small detail that I am missing, such as
> character translation during the print statement(?), one extra byte
> need somewhere, etc?

...

> ------------------------------------------
> #! C:/python21/python.exe

...

>From the above I'd guess that you're using Cygwin. On Windows (MSVC or
Cygwin) or OS/2 (VACPP or EMX/gcc), stdout (which is what print uses) will
be in text mode - ie newline characters get translated to CRLF.  If your
compressed data has a newline character (LF) in it, this will result in a
corrupted output stream.

You'll need to find a way to change stdout to binary mode ('wb').  At the
moment I don't know of a practical way to do this with either OS/2 port,
and have no information about the Win32 ports.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  | Snail: PO Box 370
        andymac at pcug.org.au            |        Belconnen  ACT  2616
Web:    http://www.andymac.org/        |        Australia





More information about the Python-list mailing list