Problem while uploading a binary file using cgi module

Andrew MacIntyre andymac at
Tue Feb 5 07:26:35 EST 2002

On Sun, 3 Feb 2002, J. Wang wrote:


> the code is like this:
> #!e:/Python22/python.exe
> import cgi


Given that a text file works and a binary file doesn't, you are almost
certainly falling foul of the CRLF<->LF newline (text/binary) translation
used by default on most DOS derived environments (I'm not certain how
Cygwin handles this).

You don't say exactly what platform your Python is running on, however if
using the standard Windows binaries, look into the docs for the msvcrt
module (setmode()).  I have something similar in development for OS2/EMX.
If Cygwin, you'll need to follow up with Cygwin folk (Jason Tishler

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at  | Snail: PO Box 370
        andymac at            |        Belconnen  ACT  2616
Web:        |        Australia

More information about the Python-list mailing list