cgi script error

Fredrik Lundh fredrik at
Thu Jan 19 16:36:05 EST 2006

Ron Griswold wrote:

> I'm getting the following error from my web server (httpd on linux):
> "malformed header from script. Bad header=<html>: htmllib.cgi

> 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.

as google could have told you in a couple of seconds, the server expects
you to start by telling it what kind of document you're returning.


    print "content-type: text/html"
    print # empty link

before the openDocument() call should fix this.

also see the "cgi spec":


More information about the Python-list mailing list