[PyQt] Exception handling hook

Arve Knudsen arve.knudsen at gmail.com
Sat May 26 17:25:30 BST 2007


On 5/25/07, Detlev Offenbach <detlev at die-offenbachs.de> wrote:
> On Donnerstag, 24. Mai 2007, Arve Knudsen wrote:
> > Hi Detlev
> >
> > On 5/24/07, Detlev Offenbach <detlev at die-offenbachs.de> wrote:
> > > On Mittwoch, 23. Mai 2007, Arve Knudsen wrote:
> > > > Is it possible to register a hook with QApplication in order to be
> > >
> > > notified
> > >
> > > > of an unhandled exception? Currently, all that happens when an
> > > > exception propagates to the event loop is that it gets printed in
the
> > > > console,
> > >
> > > which
> > >
> > > > is not very helpful. How do others cope with unhandled exceptions in
> > >
> > > PyQt
> > >
> > > > applications?
> > > >
> > > > Best regards,
> > > > Arve Knudsen
> > >
> > > See eric4 as an example.
> >
> > I'm not at all familiar with eric4. Could you please elaborate as to
where
> > I can look in eric4's source code (I assume this is what you mean)?
Also, I
> > take it eric4 does something more advanced than override sys.excepthook?
> >
> > Thanks,
> > Arve
> >
> > Detlev
> >
> > > --
> > > Detlev Offenbach
> > > detlev at die-offenbachs.de
> def main():
>     """
>     Main entry point into the application.
>     """
>     sys.excepthook = excepthook
>

Can you tell me what happens if you call a piece of Qt code
from Python which in turns invokes a Python callback, and the
latter raises an exception? In my experience sys.excepthook is useless
in this scenario, because when control returns from the
last Python callback, the exception is not propagated (i.e., there is normal
flow of control).

Arve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070526/1ead7a88/attachment.html


More information about the PyQt mailing list