[Pythonmac-SIG] newbie

Bob Ippolito bob at redivi.com
Thu Mar 11 12:39:33 EST 2004


On Mar 11, 2004, at 6:29 PM, salamander wrote:

> trying to execute the "squares.py" script from VQS's Python book, as a 
> CGI:
---
> but I get an Internal Server Error 500 in apache, and the error_log 
> shows:
>
> [Thu Mar 11 12:10:47 2004] [error] (2)No such file or directory: exec 
> of /www/test/pyvqs/squares.py failed
> [Thu Mar 11 12:10:47 2004] [error] [client 127.0.0.1] Premature end of 
> script headers: /www/test/pyvqs/squares.py

It's broken because your script is not a CGI.  All CGIs, regardless of 
language, must output valid HTTP headers.  Add this to the top of your 
script:

print "Content-type: text/html"
print

-bob




More information about the Pythonmac-SIG mailing list