Python, cgi and redirect

Fredrik Lundh fredrik at
Wed May 10 11:36:17 CEST 2000

Teemu Keskinarkaus <teemu.keskinarkaus at> wrote:
> Is there simple cgi module for python that can do redirect?? Now I'm
> doing redirect in cgi-script like this:
> print "Status: 302 Moved"
> print "Location:"
> That works fine except I get 'Premature end of script headers' errors
> in apache error_log everytime I use that script.

here's what the apache FAQ has to say about this message:

    "What does it mean when my CGIs fail with "Premature
    end of script headers"? 

    "It means just what it says: the server was expecting a complete
    set of HTTP headers (one or more followed by a blank line), and
    didn't get them."

so adding an extra print statement might help.  if it doesn't,
ignore me ;-)


More information about the Python-list mailing list