Python/Tkinter crash.

Hendrik van Rooyen mail at microcorp.co.za
Wed Oct 4 20:02:56 CEST 2006


 "Eric Brunel" <eric_brunel at despammed.com> wrote:


> On Wed, 04 Oct 2006 10:33:55 +0200, Hendrik van Rooyen
> <mail at microcorp.co.za> wrote:
>
> > Hi,
> >
> > I get the following:
> >
> > hvr at LINUXBOXMicrocorp:~/Controller/lib> python display.py
> > UpdateStringProc should not be invoked for type font
> > Aborted
> >
> > and I am back at the bash prompt - this is most frustrating, as there is
> > no
> > friendly traceback to help me guess where its coming from.
> >
> > And what is worse, the script runs for a varying time before it simply
> > exits
> > like this.
> >
> > What can I do to dig deeper to try to find a clue? - I don't even know
> > if its
> > Python, Tkinter or Linux...
>
> Neither of them: it's a tcl problem. The message you get is in the file
> generic/tclObj.c in the tcl source directory.
>
> I know the problem happens sometimes on one of my Tkinter applications,
> but I never succeeded in reproducing it systematically. I've browsed the
> tcl bugs, but didn't find anything. Maybe you'll be luckier than I... If
> you are, I'm interested in any hint you can find.

Ouch! - this is a bit the wrong answer...

What I have seen, in mucking about today, is that it seems to be related to
threading - I have a silly sort of thread that runs, updating my meters, more or
less continuously, to simulate data from the field - it just adds some values to
the seven display variables and calls the update methods that delete and redraw
the arcs representing the analogue style meters, deleting and replacing the text
objects that show the values, and then it sleeps for a while, and does it all
again.

At the same time, one other thread (other than the main thread), can be created
to move a component on the canvas around by calling its delete and draw
methods. - but this is also done more or less continuously, as a new thread is
created as soon as the previous one dies to move the next object around.

Now these two things are asynchronous with each other, so that given enough
time, they are bound to make calls to Tkinter in a re-entrant fashion, and I
suspect that it is this that is causing the problem - my "evidence" for this is
that I implemented a boolean as a sort of "lock" and had the Meter updating back
down in favour of the other animation to try and avoid any sort of re - entrancy
to the Tkinter canvas object's  delete and draw methods...

Now the Jury is still out on this - it seems to have helped, as the thing has
been running for some hours now without crashing - but maybe I have just applied
a band aid to sword cut - I don't know - if it runs through the night I will
feel much better...

Will update again as soon as I have more data...

- Hendrik





More information about the Python-list mailing list