Newbie + Linux + Apache + CGI + Python = Problem

David Lees debl at NONOtheworldSpammy.com
Mon Jan 1 19:56:16 EST 2001


You might try changing the name to a .py extension and looking at it
with your browser, just to see that it is getting to python properly. 
Also, there are error logs for apache somewhere (I forget, where) that
let you look at Python stack returns.  Real helpful for telling what is
going on in cgi stuff.

I am a newbie too, but I did get the simple stuff from:
http://www.devshed.com/Server_Side/Python/CGI/page1.html
which it looks like your example may have come from, to work.

david lees



"John F." wrote:
> 
> I am new to Linux and am trying to get a simple CGI script using Python to
> work.  The attachment hello2.cgi is the one.  The file hellop.cgi is the
> Perl analog and it works FINE.
> 
> The Apache manuals say if I see the "headers incomplete" message the script
> is bombing, but when it is run using the python command, IT WORKS.
> 
> Facts:
> 
> [1] Perl and Python script have SAME permissions and owner.
> 
> [2] Perl script runs as CGI by browsing localhost/cgi-bin/hellop.cgi
> 
> [3] mod-perl is installed but mod-python is NOT.
> 
> [4] in the cgi-bin dir I can execute the perl script at console with:
> ./hellop.cgi
> 
> [5] in the cgi-bin dir I can NOT execute the python script with:
> ./hello2.cgi  I get that it cannot find the file, BUT if I put a bogus
> command option after #!/usr/bin/python it FAILS with a Python usage prompt,
> so bash is finding python (and it is in the $PATH so it SHOULD).
> 
> I suspect I have some .conf somewhere I need to set to allow ./hello2.cgi to
> work in cgi-bin AND something else for APache.
> 
> Help please....
> 
> - John
> 
>                  Name: hellop.cgi
>    hellop.cgi    Type: unspecified type (application/octet-stream)
>              Encoding: x-uuencode
> 
>                  Name: hello2.cgi
>    hello2.cgi    Type: unspecified type (application/octet-stream)
>              Encoding: x-uuencode
> 
> [Mon Jan  1 09:40:15 2001] [error] (2)No such file or directory: exec of /home/httpd/cgi-bin/hello2.cgi failed
> [Mon Jan  1 09:40:15 2001] [error] [client 127.0.0.1] Premature end of script headers: /home/httpd/cgi-bin/hello2.cgi



More information about the Python-list mailing list