1import sys, os
2
3try:
4 raise NotImplementedError("No error")
5except Exception as e:
6 exc_type, exc_obj, exc_tb = sys.exc_info()
7 fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
8 print(exc_type, fname, exc_tb.tb_lineno)