why logging re-raise my exception and can't be caught?
daniel
daniel.huangfei at gmail.com
Sat Sep 30 03:33:03 EDT 2006
I use a simple program to illustrate the problem:
import logging
def foo() :
raise ValueError("foo")
if __name__ == "__main__" :
try :
foo()
except ValueError :
logging.exception("caught here") -- seems re-raise the
exception and can't be caught
print "caught here" --- just works.
I'm expecting the exception to be caught silently, and print the msg to
some place, if I comment out the logging statement, it just works, but
now, the stack trace is printed as if the except statement was not
there!!
how could this happen, just weird.. can I make the logging module
behave as I expected?
tks in advance.
daniel
More information about the Python-list
mailing list