Running cgi-scripts on my home Apache server

Sheila King sheila at thinkspot.net
Wed Jan 10 02:20:56 EST 2001


OK, can anyone help me with this?

I have Apache installed on a Win98 machine.
I would like to run cgi scripts.

I put a script pytestscript.py in my cgi-bin and typed:

http://127.0.0.1/cgi-bin/pytestscript.py

I get a 500 Internal Server error, and the error logs state:
"(2)No such file or directory: couldn't spawn child process:
e:/apache/cgi-bin/pytestscript.py"

I have Python in my DOS path (i.e. in the autoexec.bat file).

Just to test out whether I could get cgi-scripts to run at all, I created a
file which I named "list.bat" with these contents:

dir


and when I enter
http://127.0.0.1/cgi-bin/list.bat

it gives a directory listing of the cgi-bin directory, so cgi scripts are
working. I guess I'm just not invoking python properly? How would one do this
on a Windows/DOS system?

Here is the script in question:
---------------------------------------
#! /usr/bin/python

print "Content-type: text/html\n\n"

print "<html>\n"

print "<Head>"
print "<Title>Obligatory Python Test Script</Title>"
print "</Head>\n"

print "<Body>\n"
print "<H3>Hello</H3>"
print "<b>This is the obligatory<br> Python 'Hello\' test script<br></b>"
print "<i>Ta-da</i>"

print "</body>\n</html>"

---------------------------------------

I've run the script successfully on my website. It's here:
http://www.thinkspot.net/cgi-bin/pytestscript.py

so I know the script works. My host is running Linux/Apache.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/





More information about the Python-list mailing list