En Mon, 02 Feb 2009 06:59:16 -0200, Ron Garret <rnospa...@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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to