I want to save the name of the error and the traceback details into a variable. Here\'s is my attempt.
import sys
try:
try:
print x
except E
sys.exc_info() returns a tuple with three values (type, value, traceback).
For Example, In the following program
try:
a = 1/0
except Exception,e:
exc_tuple = sys.exc_info()
Now If we print the tuple the values will be this.
The above details can also be fetched by simply printing the exception in string format.
print str(e)