[PyKDE] Exceptions in callbacks

Pete Ware ware at cis.ohio-state.edu
Mon Feb 5 22:33:33 GMT 2001


Bruce Sass <bsass at freenet.edmonton.ab.ca> writes:

> ...but, if Qt/PyQt does not have a hook into where you want, the only
> solution may be to expect the unexpected.
And that is just what I am asking for (unless someone can think of a
better method).  What I suggested was something like:

        qt.set_exception_handler (some_function)

so that some_function() gets called when the PyQt code catches that
exception.

It'd be great to be able to do:

        while 1:
                try:
                        app.exec_loop ()
                except:
                        QMessageBox.warning (parent, 'title',
                                'Unanticipated exception')

though I don't know if Qt's exec() is reentrant and we should probably
not break old code that doesn't expect the exec_loop() to ever quit.

--pete




More information about the PyQt mailing list