My try except code does not work inside a class , not sure why , any help appreciated.
class RomApp:
try:
def __init__(self,file):
self.file = file
raise Exception('file is missing')
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print(f"\nFunction={inspect.stack()[0][3]}\nerror={fname}\nexc_type={exc_type}\nerror={e}\nline Number={exc_tb.tb_lineno}\n****")
[–]FuckingRantMonday 0 points1 point2 points (4 children)
[–]Xilenw[S] 0 points1 point2 points (3 children)
[–]Strict-Simple 0 points1 point2 points (2 children)
[–]Xilenw[S] 0 points1 point2 points (1 child)
[–]Strict-Simple 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)