CGI on Windows

R

Rainer Mansfeld

Hi all,

I'm running the following script as a minimalistic CGI server on
Windows ME:

httpd.py
--------
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler

server = HTTPServer(("", 8080), CGIHTTPRequestHandler)
server.serve_forever()

This works fine showing html files and even running python scripts.
However if I try something like
http://localhost:8080/cgi-bin/Test.py?key=123
using the following script:

Test.py
-------
import cgi

form = cgi.FieldStorage()
value = form.getfirst('key', "???")

print "Content-Type: text/html"
print
print "value = %s" % value

it shows 'value = ???' in the browswer.
In other words cgi.FieldStorage is empty.
Using a form and the 'POST' method doesn't help either.

On a 'real' Internet server (Linux/Apache) the same script works
without problems. So my conclusion is, that either the CGIHTTPServer
or the cgi module don't work on Windows, but I can't find anything
about this issue in the documentation or using Google.
Any hints?

Thanks in advance

Rainer
 
J

Jason Drew

Rainer said:
It did!

Thanks a lot Jason.
You just saved my mental health.

Rainer


You're welcome! (And thanks too to June Kim and Martin v. Löwis for
posting and fixing the bug, respectively, I think.)
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top