[pygtk] dialogs, sys.excepthook and gobject.add_idle

Chris Lambacher chris at kateandchris.net
Tue Apr 18 01:37:48 WST 2006


Hi,

I have a win32 app that overrides sys.excepthook to capture top level
exceptions and display a dialog with the error.  This was working fine until I
had an exception occur in a thread other than the main(gui) thread.  My
standard trick for getting the UI to do something from another thread is to
use gobject.add_idle.  For some reason this does not work when all the
threading set up has been done.

A very simplified sample of the error is attached.  If threading is turned on,
ie a call is made to gtk.threads_init and the gtk.threads_enter, the app
hangs.  If the threading is not started, everything works as expected.  If
threading is on and the dialog is created and run in the sys.excepthook,
everything works properly.

I have tried this with version 2.8.6 of pygtk and 2.8.14 of gtk on win32.  I
have not tried 2.4 or 2.6 versions though either would be acceptable since the
code base is known to work with pygtk 2.4 and gtk 2.4.

Anyone have any ideas?

Thanks,
Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception_handler.py
Type: text/x-python
Size: 844 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20060417/421dbb40/exception_handler.py


More information about the pygtk mailing list