Mehan CO
asked on
find the error code given by python and then put it in the except case
i want know how do it ? is it possible write it to file and i look at it later ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Above solution will always log an error and an exception if you stop your program with ctrl-C or if you kill it.
If that's an issue, then you can specifically exclude KeyboardInterrupt and SystemExit
Above solution has also solutions with multithreaded applications.
Exceptions in a thread will unfortunately not be caught by sys.excepthook
However there are some potential tricks / hacks, which might help you in such cases