[Tkinter-discuss] How to capture exceptions after the end of the program

Michael Lange klappnase at web.de
Fri Jun 25 22:39:14 CEST 2010


Hi Vasilis,

On Fri, 25 Jun 2010 12:20:30 +0200
Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch> wrote:

> Hi all,
> 
> I have a tkinter application that uses several fonts. However only
> with python 2.4 when the application is closed then I get the
> following exceptions (with 2.6 it works Ok)
> 
> Exception exceptions.AttributeError: "'NoneType' object has no
> attribute 'TclError'" in <bound method Font.__del__ of <tkFont.Font
> instance at 
> 0x2ac0dd4c4908>> ignored
> Exception exceptions.AttributeError: "'NoneType' object has no
> attribute 'TclError'" in <bound method Font.__del__ of <tkFont.Font
> instance at 
> 0x2ac0dd4c4680>> ignored
> 
> and I have no way of capturing them since they arrive even after the 
> last line of the program.
> I believe that for some reason the tkinter is deleted before and 
> afterwards it tries to delete the fonts and creates the TclError.
> Is there a way to protect for these exceptions?
> 
> I was getting the same problem with the PhotoImage() but now I am
> trying to delete all of them before the end of the program to avoid
> the exceptions. However with fonts I can miss something e.g replace a
> font and exit afterwards.
> 

Can you provide a minimal code example that exhibits the problem?

Michael



More information about the Tkinter-discuss mailing list