470,811 Members | 1,101 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

CGI on Windows

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


Jul 19 '05 #1
3 1428
I believe you're experiencing a bug that I also encountered, and for
which there is a patch. See:
http://sourceforge.net/tracker/?grou...il&aid=1110478

Fixing os.py as described in the patch fixed all my CGI-related
problems. Hope it does for you too!

Jason

Jul 19 '05 #2
Jason Drew wrote:
I believe you're experiencing a bug that I also encountered, and for
which there is a patch. See:
http://sourceforge.net/tracker/?grou...il&aid=1110478

Fixing os.py as described in the patch fixed all my CGI-related
problems. Hope it does for you too!

Jason


It did!

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

Rainer

Jul 19 '05 #3

Rainer Mansfeld wrote:
Jason Drew wrote:
I believe you're experiencing a bug that I also encountered, and for which there is a patch. See:
http://sourceforge.net/tracker/?grou...il&aid=1110478
Fixing os.py as described in the patch fixed all my CGI-related
problems. Hope it does for you too!

Jason


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.)

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Tyler Foreman | last post: by
1 post views Thread by Scott Davies | last post: by
reply views Thread by Scott Davies | last post: by
4 posts views Thread by Rod Gill | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.