How to show why "try" failed in python
Posted
by calccrypto
on Stack Overflow
See other posts from Stack Overflow
or by calccrypto
Published on 2010-06-07T10:39:07Z
Indexed on
2010/06/07
10:42 UTC
Read the original article
Hit count: 276
is there anyway to show why a "try" failed, and skipped to "except", without writing out all the possible errors by hand, and without ending the program?
example:
try:
1/0
except:
someway to show
"Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
1/0
ZeroDivisionError: integer division or modulo by zero"
i dont want to doif:print error 1, elif: print error 2, elif: etc...
. i want to see the error that would be shown had try
not been there
© Stack Overflow or respective owner