import sys
try:
print(5/0)
except Exception as e:
print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__, e)
print('And the rest of program continues')
import traceback
try:
print(4/0)
except ZeroDivisionError:
print(traceback.format_exc())