"kbperry" <[EMAIL PROTECTED]> writes:
> In Python,
> When using the default except (like following)
>
> try:
> some code that might blow up
>
> except:
> print "some error message"
This will catch *every* exception, and throw it away before it gets to
your "print" statement.
This is almost never a good idea. 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.
More information on 'try':
<URL:http://docs.python.org/ref/try.html>
--
\ "When we call others dogmatic, what we really object to is |
`\ their holding dogmas that are different from our own." -- |
_o__) Charles Issawi |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list