wxPython MainLoop exception handling problem

Kreedz kreedz at gmail.com
Mon Sep 12 19:50:32 CEST 2005


Hi,

I'm making some intelligent logging module that redirects stdout and
stderr of a wxPython GUI. I am logging the exceptions in a wx TreeCtrl.
My problem is that when an exception is thrown, there are many calls to
stderr that are made which gives this kind of result:

Traceback (most recent call last):
  File "C:\somefolder\logger.py", line 711, in onTimer
a.index('notinlist')
ValueError
:
list.index(x): x not in list

(That is a test exception I made...)

Obviously I would not want it to use so many lines in the TreeCtrl, and
the lonely ":" on its line looks weird.

I looked through the wx App and saw the "OnExceptionInMainLoop"
function but could not override it successfully. Anybody have an idea
on how I could handle the exception myself so that I dont get lots of
calls to stderr ?

Thanks a lot!

- Kreedz




More information about the Python-list mailing list