cgi.FieldStorage hanging with Python 3.0 (but works with 2.5.1)
Andy Grove
andygrove73 at gmail.com
Tue Jan 13 18:24:57 EST 2009
I'm trying to get a Python web server running that I can upload files
to. I actually have the code running with the version of Python pre-
installed on Mac OS X but it doesn't work with ActivePython 3.0 - I
have not been able to compile Python from source myself to see if the
issue is specific to the ActivePython distribution.
Here is the relevant code:
class MyHandler(http.server.BaseHTTPRequestHandler):
def do_POST(self):
try:
print( "Calling cgi.FieldStorage()" )
form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={'REQUEST_METHOD':'POST',
'CONTENT_TYPE':self.headers['Content-
Type'],
})
print( "Calling cgi.FieldStorage()" )
The client is the following HTML form being submitted with Firefox
3.0.5 running on the same machine. The browser also hangs, waiting for
a response from the server.
<form action="http://localhost:8090/deploy" method="POST"
enctype="multipart/form-data">
<table>
<tr><td>File:</td><td><input type="file" name="filename"></td></tr>
<tr><td> </td><td><input type="submit" value="Deploy"></tr>
</table>
</form>
As I said, this all works fine with Python 2.5.1 pre-installed.
Any suggestions?
Thanks,
Andy.
More information about the Python-list
mailing list