"Wrap" a python-cgi

Hermann Himmelbauer dusty at strike.wu-wien.ac.at
Thu Mar 8 12:48:31 EST 2001


Hi,
I am currently using python for several cgi programs. One problem is that 
if my cgi-script has a bug it exits with an exception and the user gets an 
ugly error message done by the webserver.

I would like to put some really simple "bugfree" (if something like this 
can exist :-) "wrapper" around my cgi-scripts, let it trap Exceptions, log 
the error and let it output a nice error page to the user.

My first approach would perhaps be to wrap the whole script into a "try: 
except" clause but at first I don't know if nested try/except clauses are 
allowed and moreover the whole script looks somehow ugly as every line is 
indented.

Perhaps you know a better solution?

                Best Regards,
                Hermann

-- 
 ,_,
(O,O)     "There is more to life than increasing its speed."
(   )     -- Gandhi
-"-"--------------------------------------------------------------



More information about the Python-list mailing list