sys.excepthook
Mel Tearle
mel.tearle at gmail.com
Sun Apr 21 18:53:08 BST 2024
Thanks Phil,
Good tip, doesn’t explain why a type error that I’ve encountered
before or any other previous tracebacks hosed python, but it works.
def hook(type, value, traceback):
tb = traceback
line_no = tb.tb_lineno
filename = tb.tb_frame.f_code.co_filename
f = f'\n{type}: error has occurred \nthe value: {value} \n'
print( f' {f} {filename} \n at line number: {line_no}')
sys.exit()
sys.excepthook = hook
Mel Tearle
More information about the PyQt
mailing list