[Tutor] Redirect from a CGI script
paulino1 at sapo.pt
Sat Jan 20 03:10:15 CET 2007
Thank you Andre,
well it doesn't work either!
> Andre Engels escreveu:
> 2007/1/18, Paulino <paulino1_at_sapo.pt at .syntax-error>:
> How can i redirect to another URL from a python CGI script.
> Is's suposed to be as simply as:
> print "Location : http://newurl "
> It's not working.
> this simple code does't work - < redir.pyw>
> 'print "Content-Type:text/html\n\n"
> 'print "Location : /cgi-bin/ecodiv.pyw "
> I use CGIHTTPServer, the server script is as follows:
> 'from BaseHTTPServer import HTTPServer
> 'from CGIHTTPServer import CGIHTTPRequestHandler
> 'HTTPServer(("localhost", 80), CGIHTTPRequestHandler).serve_forever()
> instead of redirecting, it only prints 'Location :
> /cgi-bin/ecodiv.pyw' inthe
> I haven't tested it, but I think I had a similar error recently, and
> that was solved by removing the \n\n at the end of the Content-Type
> line. You could try that.
> Andre Engels, andreengels at gmail.com <mailto:andreengels at gmail.com>
> ICQ: 6260644 -- Skype: a_engels
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor