I am just getting started with python cgi programming. I started out rather ambitiously with a python script that ran but failed. I have since been whitling it down to barebones, and somewhere along the way it stopped executing altogether. I now get the following error when I try to run any python script.
My python file currently consists of (only):
import cgi, os
import cgitb; cgitb.enable()
#form = cgi.FieldStorage() # instantiate only once!
print "<!DOCTYPE html>" # HTML is following
print # blank line, end of headers
print "<TITLE>CGI script output</TITLE>"
print "<H1>This is my first CGI script</H1>"
print "Hello, world!"
#for key in form.keys():
# print key
If I run it from the shell it runs fine, but gives the above error when I call it from a web browser, either directly or in a post statement on a web form.
I've also run dos2unix on it from the shell just because, but that didn't help.