Extreme Yaro weirdness

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Feb 2 10:39:50 EST 2009


En Mon, 02 Feb 2009 06:59:16 -0200, Ron Garret <rNOSPAMon at flownet.com>  
escribió:

> I'm running the following WSGI app under Yaro:
>
> def error(req):
>   try:
>     req.non_existent_key
>   except:
>     try:
>       return cgitb.html(sys.exc_info())
>     except:
>       return 'foo'
>
> The result of running this is 'foo'.  In other words, the reference to
> the non-existent key generates an exception as expected, but then the
> generation of the traceback generates ANOTHER exception, which I would
> not have expected.  If I add another TRY/EXCEPT block to capture this
> exception, the result is attached at the bottom of this message.

Unqualified excepts are evil -- see this recent post (mine)
http://groups.google.com/group/comp.lang.python/msg/05e822f694b6421c

But in this case you hit a known bug in cgitb - see  
http://bugs.python.org/issue4643 for a solution.

-- 
Gabriel Genellina




More information about the Python-list mailing list