I'm going crazy using cgi module. HELP PLEASE!!!!

Gerhard Häring gh_pythonlist at gmx.de
Sun Apr 7 16:54:43 EDT 2002


* Stefan Schwarzer <s.schwarzer at ndh.net> [2002-04-07 22:17 +0200]:
> I didn't investigate your code in detail but it may be that there's an
> defect in it which causes an exception. You may use
> 
> import sys
> sys.stderr = sys.stdout
> 
> at the top of your module to receive a traceback in the browser window
> or catch the exception with
> 
> try:
>     ...
> except:
>     # do something with sys.exc_info()

If you're using Python >= 2.2 (*), you may want to use the cgitb module
for debugging by putting this on top of your script:

import cgitb
cgitb.enable()

Be sure to have the Content-type set to text/html to display the nicely
formatted tracebacks.

Gerhard

(*) Else you'll have to get the cgitb module yourself.
-- 
This sig powered by Python!
Außentemperatur in München: 4.2 °C      Wind: 3.0 m/s





More information about the Python-list mailing list