[pygtk] exception handling

John Hunter jdh2358 at gmail.com
Fri Jan 30 07:29:38 WST 2009


On Thu, Jan 29, 2009 at 4:03 PM, John Stowers
<john.stowers.lists at gmail.com> wrote:
> On Thu, 2009-01-29 at 12:00 -0600, John Hunter wrote:
>> If I raise an exception in a gobject timeout function, is there a way
>> for me to catch it hand handle it in the main thread?  Here I
>> try/except the "run" method, but the exception does not propagate.  I
>> recall there are difficulties in cross thread signal and exception
>> handling, and am wondering what the right approach is.   I am not
>> writing a UI here, just using the gobject event loop in a cron script.
>>  Here is some example code
>
> If you just want to stop the timeout from running you can return false.
>
> If you want the program to exit then you could pass the mainloop as an
> extra arg to the ontimer function, and then stop it from there, which
> would exit the program

Sorry, my post wasn't clear.  I don't want either of these things.  I
want to catch the exception at the main level so I can handle it.  The
problem is that the exception is not being propogated to the main
level.  The post is about exception handling across threads -- the
rest is just example code.

JDH


More information about the pygtk mailing list