try handle in python code example
Example 1: how to print error in try except python
try:
# some code
except Exception as e:
print("ERROR : "+str(e))
Example 2: python 3 except sys error info
1 import sys
2 try:
3 untrusted.execute()
4 except: # catch *all* exceptions
5 e = sys.exc_info()[0]
6 write_to_page( "<p>Error: %s</p>" % e )