help: cgi "post" problem (client side)
Gilles Lenfant
glenfant.nospam at bigfoot.com
Wed May 2 07:09:15 EDT 2001
Hi,
I'm making some CGI tests with Win98 and MS Personal Web Server.
I installed this simple test cgi script:
=======test.py=======
import cgi
cgi.test()
=====================
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/test.py" method="POST">
<input type="text" name="param1">
<input type="text" name="param2">
<input type="submit">
</form>
...
=======
But when I do this through this script, this goes to a deadlock:
=======runcgi.py=======
import urllib
params = {'param1': 'data1', 'param2': 'data2'}
cparams = urllib.urlencode(params)
# Deadlock in next line
fh = urllib.urlopen('http://localhost/cgi-bin/test.py', cparams)
# No deadlock with no "cparams" like this
# fh = urllib.urlopen('http://localhost/cgi-bin/test.py')
=======================
But aren't the HTML and runcgi.py supposed equivalent ?
Did I miss something or should I use Apache or another Web server ?
Thanks in advance for any hint.
Gilles
More information about the Python-list
mailing list