Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:19 AM
Rainer Mansfeld
Guest
 
Posts: n/a
Default 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




  #2  
Old July 19th, 2005, 02:20 AM
Jason Drew
Guest
 
Posts: n/a
Default Re: CGI on Windows

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

  #3  
Old July 19th, 2005, 02:20 AM
Rainer Mansfeld
Guest
 
Posts: n/a
Default Re: CGI on Windows

Jason Drew wrote:[color=blue]
> 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
>[/color]

It did!

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

Rainer

  #4  
Old July 19th, 2005, 02:20 AM
Jason Drew
Guest
 
Posts: n/a
Default Re: CGI on Windows


Rainer Mansfeld wrote:[color=blue]
> Jason Drew wrote:[color=green]
> > I believe you're experiencing a bug that I also encountered, and[/color][/color]
for[color=blue][color=green]
> > which there is a patch. See:
> >[/color][/color]
http://sourceforge.net/tracker/?grou...il&aid=1110478[color=blue][color=green]
> >
> > Fixing os.py as described in the patch fixed all my CGI-related
> > problems. Hope it does for you too!
> >
> > Jason
> >[/color]
>
> It did!
>
> Thanks a lot Jason.
> You just saved my mental health.
>
> Rainer[/color]


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

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles