I recently came across cgitb
. It's awesome, especially for the kind of thing I was trying to solve.
However, I have a simple requirement :
Is it possible to write out the exception trace on to a file and still continue post that as well. I know how to write out the exception to some file, but I am looking for the latter part.
Here's what I have tried:
import cgitb
cgitb.enable()
'''
try:
print(str(10/0))
except Exception as e:
print "Hello"
print "Tesla"
'''
So with the try-except block uncommented and without cgitb, I get Tesla
printed out as well after the stack trace. But with cgitb enabled and the try-except block commented out, although I get a better stack trace, Tesla
does not get printed out.
Is there someway that we can still get Tesla
printed out while using cgitb