why logging re-raise my exception and can't be caught?

Steve Holden steve at holdenweb.com
Sat Sep 30 04:18:58 EDT 2006


Ben Finney wrote:
[...]
> A 'try ... except' statement is not an exception handler. [...]

Just as a matter of interest, what would your definition of an exception 
handler be, then? Specifically, what's the "except" clause for?

The docs for looging.except should make it explicit that the exception 
will be re-raised.

Of course it might be possible to do something hackish like

     try:
         ...
     except:
         try:
             logging.exception(...)
         except:
             pass

which (although untested) should theoretically allow the catching (for a 
second time) of teh exception reraised by logging.exception().

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list