exception_try_block.py

#!/usr/bin/python3
# ==================================================================
#
# ==================================================================

import sys

# ------------------------------------------------------------------
#
# ------------------------------------------------------------------

##file = "exception_try_block.py"
file = "abc.txt"

try:
   f = open(file,"r")

   for l in f:
       print(l,end="")

   f.close()

except Exception as e:

   ##print(e.message)
   print(e.args)
   print("---traceback-----------------------------------------")
   tb = sys.exc_info()[2]
   print(tb)
   print("-----------------------------------------------------")

else:
   pass

finally:
   pass