CGI Script using Python

Bruno Mattarollo brunomadv at ciudad.com.ar
Mon Jan 3 19:48:44 EST 2000


Hello.

	Well, I have tryied the same script on my Solaris with Apache 1.3.9 and Python 1.5.2 and it worked. Does it work running it from the shell command line?

	Anyway I think (but I am not sure) that it's not valid HTML... But it has nothing to do with the error you are reporting...

	Hope this helps.


/B

Bruno Mattarollo <brunomadv at ciudad.com.ar> 

-----Mensaje original-----
De: python-list-admin at python.org [mailto:python-list-admin at python.org]En
nombre de Paul E. Bible
Enviado el: Monday, January 03, 2000 9:21 PM
Para: python-list at python.org
Asunto: CGI Script using Python


Hi there,

I'm currently developing a CGI script using Python under Apache Web Server.
I've written a simple script, placed it in the /cgi-bin subdirectory and
perform a chmod 755 on it.  Here is the script:

-----------------------------------------------------------
#!/usr/local/bin/python
import os, string, sys
from cgi import *

def Main():
    print "Content-type: text/html\n\n"
    print "<HTML>"
    print "<HEAD>"
    print "This is a test"
    print "</HEAD>"
    print "<BODY></BODY>"
    print "</HTML>"
    sys.exit(0)

Main()
-----------------------------------------------------------

When the above script is executed on Apache, I get the following message:

-----------------------------------------------------------
500 Internal Server Error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete
your request.

Please contact the server administrator, webmaster at domain.com and inform
them of the time the error occurred,
and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
-----------------------------------------------------------

The Apache error log indicates a 'Premature end of script headers:
/usr/local/apache/cgi-bin/test.py'.

My platform is:  Redhat Linux 6.2, Apache Web Server 1.3.9, Python 1.5.2

Any help with this matter would be greatly appreciated.

Thanks in advance,
Paul

----------------------------------------
Paul E. Bible
pbible at littlefishsoftware.com
www.littlefishsoftware.com
----------------------------------------





-- 
http://www.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list