FAQ
I am trying to upload files through cgi script written in python 3.1
on a Windows IIS 7 server.
The server time out when I write in usual way that is

form=cgi.cgi.FieldStorage()
fileitem = form['filename']
fn = os.path.basename(fileitem.filename)
open('/tmp/' + fn, 'wb').write(fileitem.file.read())

I think there is a problem with stdin, I checked it with:

s=sys.stdin.buffer.read(1024)
print (s)

I prints the first 1024 bytes of the input stream. But when I write

s=1
while s:
s=sys.stdin.buffer.read(1024)
print (s)

the server stops responding. I think there is a problem that Python
cannot understand end of input stream.

I searched this on the net but could not find a solution.

Thanks

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedFeb 25, '10 at 4:35p
activeFeb 25, '10 at 4:35p
posts1
users1
websitepython.org

1 user in discussion

Huseyin: 1 post

People

Translate

site design / logo © 2022 Grokbase