[Tkinter-discuss] Catching exceptions
camfarnell at cogeco.ca
Tue Jan 31 06:52:25 CET 2006
ProgramA (a Tkinter application) contains this code snippet:
<code to handle the exception>
Where it runs programB.
ProgramA would like to catch and handle any otherwise uncaught
exceptions in ProgramB. If programB is NOT a Tkinter application then
ProgramA does indeed catch and handle exceptions that occur in programB.
However, if ProgramB is a Tkinter application then virtually all the
action takes place inside callbacks and any exceptions in those
callbacks are caught and handled by Tkinter, thus never getting to
exception handler in ProgramA.
Is there any way to tell Tkinter not to handle exceptions in callbacks
so that on an exception in a callback programB would grind to a halt and
the exception handler in ProgramA would take over? Or would this violate
some fundamental principle of how Tkinter works?
Any knowledgable advice on this would be *greatly* appreciated.
If you are wondering what I'm up to, ProgramA is an (under construction)
development environment which has produced ProgramB which we would now
like to run. If execution of ProgramB goes badly we would like to show a
traceback and then be able to take you to the offending line of code.
But if Tkinter catches and hides the error, that's hard to do.
More information about the Tkinter-discuss