CGI module does not parse data

amfr amfr.org at gmail.com
Thu Dec 1 17:34:02 EST 2005


I am writing a webserver, and I want it to be able to run python
scripts.  But when I set sys.stdin to self.rfile (using the
BaseHTTPServer class, self.rfile is a input stream containing the
request), the cgi module does not parse the data.
Example script:
import cgi
form = cgi.FieldStorage()
print form["testfield"]

The above script would print nothing.  Should i be setting sys.stdin to
something else, or is there anthoer solution entirely?




More information about the Python-list mailing list