Trying to write CGI script with python...

Jason Mobarak jason.mobarak at gmail.com
Sat Apr 30 20:37:56 EDT 2005


M.E.Farmer wrote:
> I found an excellent example that was posted by the F-bot.
[...]
> try:
>     import myscript
>     myscript.main()
> except:
>     print "Content-Type:", "text/html"
>     print
>     file = StringIO.StringIO()

Note: it's usually a very bad idea to name -anything- "file" unless you
intentionally want to clobber the name of the built-in file object.

>     traceback.print_exc(file=file)
>     print "<pre>"
>     print cgi.escape(file.getvalue())
>     print "</pre>"
>
> > I haven't got access to error logs so I can't look at it that way.
> 
> </F>




More information about the Python-list mailing list