Problems with running Python CGI Scripts

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Sep 3 05:44:51 EDT 2008


En Wed, 03 Sep 2008 05:29:39 -0300, Edward FISHER <edward.fisher at st.com>  
escribi�:

> I can get the script to run the python script but all that happens is  
> that the black python box appears then disapears, the html that the  
> python scripts should generate is never output.
> [...]
> This is calling the pyc file of the python script. I dont understand why  
> if i call the py file itself all i get returned is the plain text of the  
> python file.

That's a server setting (Apache or whatever) - make sure it is configured  
to *execute* the script.

> The python script is:
>
> #!/usr/local/bin/python
> import cgi
>
> def main():
> print "Content-type: text/html\n"

I hope this is just the way you posted your message, but remember that in  
Python indentation is important. The above code isn't valid. Once you are  
sure that your script doesn't have syntax errors, add this lines on the  
top to help debugging:

import cgitb; cgitb.enable()

-- 
Gabriel Genellina




More information about the Python-list mailing list