cgi script error

Ron Griswold RGriswold at Rioting.com
Thu Jan 19 16:30:16 EST 2006


Hi Folks,
 
I'm getting the following error from my web server (httpd on linux):
"malformed header from script. Bad header=<html>: htmllib.cgi
 
The script I'm running is a Python script as follows:
 
#!/usr/bin/python
 
def openDocument( ):
            print """<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\">""";
 
def openHTML( ):
            print "<html>";
            
def closeHTML( ):
            print "</html>";
            
def openHead( ):
            print """<head>\n\t<meta HTTP-EQUIV=\"CONTENT-TYPE\"
CONTENT=\"text/html; charset=utf-8\">""";
 
def closeHead( ):
            print "</head>";
            
def openBody( ):
            print "<body>"
            
def closeBody( ):
            print "</body>";
            
def title(string=""):
            print "\t<title>%s</title>" % string;
            
def p(string="", align="left", fontSize=3):
            print "<p align=%s><font size=%d>\n%s\n</font></p>" %
(align, fontSize, string);
 
def br( ):
            print "<br>";
 
 
if(__name__ == "__main__"):
            
            #openDocument();
            openHTML();
            #openHead();
            #title("Test Page");
            #closeHead();
 
            openBody();
 
            p("this is a test. this is a test. this is a test. this is a
test. this is a test. this is a test. this is a test. this is a test.
this is a test. this is a test.", "center", 4);
 
            closeBody();
 
            closeHTML();
            
It gives the same complaint if I've got openDocument and/or openHead
uncommented. The script is executing otherwise the error wouldn't show
up in the error_log with specific text from the script. Also, I've run
the script and redirected it's output to an .html file and the server
loads it with no problems. 
 
Any ideas are appreciated.
 
Thanks,
 
Ron Griswold
Character TD
R!OT Pictures
rgriswold at rioting.com
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060119/bf8c2fca/attachment.html>


More information about the Python-list mailing list