[Tutor] CGI fails

D-Man dsh8290@rit.edu
Wed, 20 Sep 2000 11:25:08 -0400


--AWniW0JNca5xppdA
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Hi.

I'm trying to use Python to do some CGI scripting on my webserver.  I followed
the directions in the FAQ to enable CGI on the server's conf files (Apache on
Linux x86).

I was trying the "Hello World" example (attached), but I get an "Internal
Server Error".  The error log file says:

[Wed Sep 20 11:19:16 2000] [error] [client 129.21.137.39] Premature end of
script headers: /home/dman/public_html/script.py.cgi
[Wed Sep 20 11:19:16 2000] [error] [client 129.21.137.39] Premature end of
script headers: /home/dman/public_html/script.py.cgi


What does this mean and how do I fix it?

-D
--AWniW0JNca5xppdA
Content-Type: application/x-cgi; charset=us-ascii
Content-Disposition: attachment; filename="script.py.cgi"

#!/usr/bin/python

def main():
   print "Content-type: text/html"
   print
   print "<HTML>\n"
   print "<TITLE> Hello, World!</TITLE>"
   print "<BODY>\n"
   print "Hello, World!"
   print "</BODY>\n\n</HTML>"

if (__name__ == "__main__"):
   main()


--AWniW0JNca5xppdA--