Bruce Eckel example / CGI server for localhost for Windows XP possible?
Piotr Luszczek
luszczek1 at yahoo.com
Sat Jan 10 12:25:49 EST 2004
--- Will Stuyvesant <hwlgw at hotmail.com> wrote:
> Is there anybody who can provide simple example code
> like found in
> Fredrik Lundh's Python Standard Library book for
> setting up a CGI
> server for localhost with Python? Perhaps the
> examples that are
> available work on linux, but not on my Windows XP
> laptop with Python
> 2.3.3: GET works and the first POST works too,
> subsequent POSTs crash.
This is simple:
http://www.geocities.com/luszczek1/httpd_py.html
and seems to work with multiple POSTs. But it doesn't
seem to be able to handle file upload correctly. At
least as this script is concerned:
def main():
form = cgi.FieldStorage()
fc = form.getvalue("fc", "")
print "Content-type: text/html\r\n\r\n",
print "<html><body>"
if fc:
print "File", repr(fc), str(dir(fc))
fc = form["fc"]
print "<pre>"
print fc.file.value
print "</pre>"
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
More information about the Python-list
mailing list