Problems with Python CGI under Windows

Domingo López López domingo at visual-tools.com
Mon Jul 1 10:03:13 EDT 2002


Hello everybody. This is the first time I am writting to this list.

I am trying to read -from the standard input- a binary (JPEG) file
in a Windows web server with a CGI. The problem is that python does 
not seem to support binary reading from standard input, because
the reading stops when a 0x1A character (CTRL-Z) end of file arrives.

Would it be possible to make a whole reading from the stdin of the JPEG
file?

(with a C CGI I have achieved it)

A few lines of my CGI:

[...]

contentLength = os.environ[CONTENT_LENGTH]

x = open('myfile.jpg', 'wb')
x.write(os.read(sys.stdin.fileno(), contentLength))
x.close()

[...]

Some help would be appreciated. Thanks a lot in advance.

Domingo López.





More information about the Python-list mailing list