Problem while uploading a binary file using cgi module

Andrew MacIntyre andymac at bullseye.apana.org.au
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
perhaps?)

--
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