Use this instead:
import sys
try:
???
except:
e = sys.exc_value
do_with(e)
Only at the outermost block on your code, if ever... The fact that
some exceptions don't inherit from Exception is on purpose -- usually
you *dont* want to catch (and swallow) SystemExit (nor
KeyboardInterrupt, and a few more I think)
Yes, this was at the outermost block of my thread's run method.
SystemExit exception did not generate an "exception in Thread-32" type
traceback on stderr because for Python, it seemed to be a "normal" exit
of the thread. So I wrote an except block, to see why the thread has
been stopping. In this case, catching SystemExit was desired. The
problem was in my mind: I thought that "except Exception,e:" will catch
everything.
The solution was to replace "raise SystemExit(0)" with "raise
TransportClosedException()" in another class.
Thanks again,
Laszlo
--
http://mail.python.org/mailman/listinfo/python-list