[Pythonmac-SIG] newbie
salamander
andrew at salamander.net
Thu Mar 11 13:07:18 EST 2004
like this?
#!/usr/bin/python
print "Content-type: text/html"
print
for x in range(1,6):
print x, x*x
still bombs :(
[Thu Mar 11 13:06:19 2004] [error] (2)No such file or directory: exec
of /www/test/pyvqs/squares.py failed
[Thu Mar 11 13:06:19 2004] [error] [client 127.0.0.1] Premature end of
script headers: /www/test/pyvqs/squares.py
On Mar 11, 2004, at 12:39 PM, Bob Ippolito wrote:
>
> 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