In python except block, I want to print the error message but I don’t want the program to stop executing, I understand that I have to do something like this
try:
1/0
except:
print errorMessage
In the except part, I am looking to put something like java’s printStackTrace()
Take a look at
traceback.print_exc()and the rest of thetracebackmodule.There are some more examples towards the end of the
tracebackdocumentation page.