threads and exception in wxPython

Zunbeltz Izaola zunbeltz at wm.lc.ehu.es.XXX
Wed Nov 3 03:41:39 EST 2004


Josiah Carlson <jcarlson at uci.edu> writes:

> from StringIO import StringIO
> import traceback
> import Queue
> 
> traceback_queue = Queue.Queue()
> 
> ...
>     def run(self):
>         try:
>             ...
>         except:
>             tb = StringIO()
>             traceback.print_exc(tb)
>             traceback_queue.put(tb.getvalue())
> ...
> 
> 
>  - Josiah
> 

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?

TIA

Zunbeltz Izaola

-- 
Zunbeltz Izaola Azkona                    |  wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila      |
Zientzia eta Teknologia Fakultatea        |  Phone: 34946015326
Euskal Herriko Unibertsitatea             |   
PK 644                                    |  Fax:   34 944648500
48080 Bilbo (SPAIN)                       |



More information about the Python-list mailing list