#! /usr/bin/python3 # ================================================================= # # # See Traceback Documentation: # docs.python.org/3/library/traceback.html # ================================================================== import sys, traceback try: a = x # error ##a = 10 / 0 # error ##a = x[2] # error except Exception as e: ##except: ## e = sys.exc_info() ## print("Error: ", sys.exc_info()[0]) ## print("Error: ", e[0]) ## for x in e: ## print(type(x),' ',x) print('-'*60) print(type(e)) print('-'*60) for x in e[2]: print(type(x),' ',x) print('-'*60) traceback.print_tb(e,file=sys.stdout)