I want to try a statement and if there is an error, I want it to print the original error it receives, but also add my own statement to it.
I was looking for this answer, found something that was almost complete here.
The following code did almost all I wanted (I'm using Python 2 so it works):
except Exception, e:
print str(e)
This way I can print the error message and the string I wanted myself, however it does not print the error type (IOError
, NameError
, etc.). What I want is for it to print the exact same message it would normally do (so ErrorType: ErrorString
) plus my own statement.