1try:
2 raise NotImplementedError("Not implemented")
3except Exception as e:
4 exception_type, exception_object, exception_traceback = sys.exc_info()
5 filename = exception_traceback.tb_frame.f_code.co_filename
6 line_number = exception_traceback.tb_lineno
7
8 print("Exception type: ", exception_type)
9 print("File name: ", filename)
10 print("Line number: ", line_number)
1import traceback
2
3try:
4 print(4/0)
5except ZeroDivisionError:
6 print(traceback.format_exc())
7