CGI and logging module
Andrew James
drew at gremlinhosting.com
Thu Nov 18 17:20:26 EST 2004
Peter,
Have you considered using mod_python as an alternative to CGI? It offers
a number of benefits including partial session support, integration into
Apache's internals and caching bytecode. I can provide you with some
sample code if you wish (although the online documentation is very good)
Regards,
Andrew
On Thu, 2004-11-18 at 22:37 +0100, Peter Otten wrote:
> Peter Hansen wrote:
>
> > 2. If you want to see what is going wrong, put a try/except
> > around the import statement and try to write something useful
> > along with your results:
> >
> > err = ''
> > try:
> > import logging
> > except Exception, ex:
> > err = str(ex)
> >
> > print 'Content-type: test/html\r\n\r\n'
> > blah blah blah
> > print '<p>Error: %s</p>\r\n'
> >
> > If you can manage to import the sys and traceback modules,
> > you can get a more fully formatted exception using
> > ''.join(traceback.format_exception(*sys.exc_info()))
>
> I've just discovered the cgitb module, which offers a minimally intrusive
> way to debug cgi scripts - just add
>
> import cgitb
> cgitb.enable()
>
> at the top of the script.
>
> (Yet another)
> Peter
>
--
Andrew James <drew at gremlinhosting.com>
More information about the Python-list
mailing list