help: cgi "post" problem (client side)

Gilles Lenfant glenfant.nospam at
Wed May 2 07:09:15 EDT 2001


I'm making some CGI tests with Win98 and MS Personal Web Server.

I installed this simple test cgi script:
import cgi

cgi.test() is from the standard distribution and displays the headers, the
environment variables and the cgi arguments (HTML fomated).
This work and displays th cgi form parameters when I call it from a browser
with this HTML:

<form action="http://localhost/cgi-bin/" method="POST">
<input type="text" name="param1">
<input type="text" name="param2">
<input type="submit">

But when I do this through this script, this goes to a deadlock:
import urllib
params = {'param1': 'data1', 'param2': 'data2'}
cparams = urllib.urlencode(params)
# Deadlock in next line
fh = urllib.urlopen('http://localhost/cgi-bin/', cparams)
# No deadlock with no "cparams" like this
# fh = urllib.urlopen('http://localhost/cgi-bin/')

But aren't the HTML and supposed equivalent ?
Did I miss something or should I use Apache or another Web server ?
Thanks in advance for any hint.


More information about the Python-list mailing list