Pmw Error: "TclError: can't unset "unknown_pending(": no suchvariable"

Marc losnations at comcast.net
Sun Feb 16 17:10:23 EST 2003


Ok. So I guess I have a thread problem, but that brings me to a question. I
tried to avoid this problem by providing function wrappers in the thread. In
other words, I used functions in the class containing the second thread to
call functions in the class contained in the main thread. I thought I could
get around the Tk/Thread problem by doing this, but that's not the case. I
guess I'm a little confused over the distinction of where or when a function
is called.

If someone could please explain or refer me to a resource of what
constitutes a "function call." The way it appears is that even though the
actual function is contained in another class originally defined in another
thread, because the overall call process originated in the second thread it
still gets hosed.  Therefore, no matter where you place the function or how
many levels separate it, it will always be classified as originating in the
second thread, and there's no way to redirect it.

Which brings me to the proposed solution, the queue. How does a queue get
around this problem when you are still calling the function from somewhere
else? If you place a function call inside of a queue, doesn't it still
originate from the second thread, even though it's popped out in the main
thread?

Thanks again,
Marc


"Chad Netzer" <cnetzer at mail.arc.nasa.gov> wrote in message
news:mailman.1045268868.16351.python-list at python.org...
> On Fri, 2003-02-14 at 15:54, Marc wrote:
>
> > I'm getting an error that I can't find an explanation for. It's very
> > intermittent and works 99% of the time. Then that 1% comes along and
> > causes my app to crash.
>
> Before reading any further, I suspect you might be using threads.
>
> >  It causes a window's exception, and an error
> > log is generated. This is unusual because usually Python errors are
> > caught before it ever hits windows. Here's the error:
> >
> > ----------------------------------------------------------
> > Exception in thread Thread-1:
> > Traceback (most recent call last):
> >   File "threading.pyc", line 408, in __bootstrap
>
> Aha!
>
> > It could be a threading issue.
>
> Bingo.  You must do all your calls to Tkinter (and hence Tcl) in a
> single thread.  Thus, only one thread should know about widgets.
> Absolutely only one thread can be in mainloop() (!!).
>
> What are the threads doing?  Unless you say otherwise, I'm going to
> assume this is an issue with multiple threads interacting with the GUI
> objects.  There are discussions on the Web and the group about how to
> deal with this, so some googling may be of help.  Also, the Queue object
> is often recommended for having a master UI thread communicate with
> workers (but I've never used it)
>
> > Thanks ahead of time,
> > Marc
>
> --
> Bay Area Python Interest Group - http://www.baypiggies.net/
>
> Chad Netzer
> (any opinion expressed is my own and not NASA's or my employer's)
>
>
>






More information about the Python-list mailing list