Ben Finney writes: > You should catch *specific* exceptions that you know you can deal with at > that point in the code. > > import logging > try: > foo = 12 / 0 > except ZeroDivisionError, e: > print "You *knew* this was going to happen: '%s'" % e > logging.error(str(e)) > > This allows all other exceptions to propogate back through the call > stack.
import sys, logging try: foo = 12/0 except: e = str(sys.exc_value) print "You *knew* this was going to happen: '%s'" % (e) logging.error(e) -- http://mail.python.org/mailman/listinfo/python-list