En Tue, 24 Feb 2009 11:09:44 -0200, Laszlo Nagy <gand...@shopzeus.com> escribió:

It seems impossible to me. The while loop should only exit if stop_requested becomes set, OR if an exception is raised. However, all exceptions are cought and logged. But there are no exceptions logged. And stop_requested is NOT SET. (see the last line in the log).

What is happening here?

It was a bad assumption. Not all exceptions are subclasses of "Exception". In this case, an inner call raised SystemExit(0).

Glad to see you finally found what was happening!

So be aware. Don't think that this will catch all exceptions:

try:
    ???
except Exception,e:
   do_with(e)


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)

--
Gabriel Genellina

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

Reply via email to