cgi.FieldStorage hanging with Python 3.0 (but works with 2.5.1)

A

Andy Grove

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>&nbsp;</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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top