[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    sys.excepthook
From:       Mel Tearle <mel.tearle () gmail ! com>
Date:       2024-04-21 17:53:08
Message-ID: 9D1EB687-50E6-4405-947B-3C850AC0AB56 () gmail ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic