threads and exception in wxPython

Michael Hobbs mike at hobbshouse.org
Wed Nov 3 14:35:11 EST 2004


Zunbeltz Izaola <zunbeltz at wm.lc.ehu.es.xxx> wrote:
> Ok, thanks for the help. But  I still have a problem. When the lines
> in the try block raise an exception it is saved in the traceback_quee
> and the thread is finished. Is that correct?. The problem is how do I
> inspect the queue? The function that creates the thread is something
> like that
> 
>    def OnMeasurement(self):
>        self.CurrentMeasurement.start()
> 
> If I put some code after the .start() method the queue will be
> empty. Do I need to insert a infinite loop to see when the exception
> is raised?

In addition to adding the exception to the queue, you should post
a custom event to the main window or wx.App. The callback bound to
that event would then read the exception out of the queue and print
it, raise it, send an email, whatever.

-- Mike



More information about the Python-list mailing list