[PyKDE] Exceptions in callbacks (again)

Thomas Gfüllner T.Gfuellner at Linux-AG.com
Fri Mar 2 15:10:58 GMT 2001


Hi,

Phil Thompson wrote:

> It should, in theory, be possible to trap the exceptions. If you look at
> sipEmitToSlot() in qtlib.cpp (in SIP) you see that it implements the Qt
> feature of being able to call a slot with too many arguments. It does
> this by detecting the exception, checking what type it is, and re-trying
> the call with one less argument. (Python is a lovely language to work
> with.) So something could be done.

> However, for the reasons you give I'm not so keen on a solution that
> would allow your example to work. Out of interest, what happens when you
> build your own event loop and use processOneEvent() - ie. use that
> instead of exec_loop() in you example?

I tried:

   while 1:
       try:
           app.processOneEvent()
       except:
           print "I'm so happy"

But I had no luck to see "I'm so happy", the message of the exception
goes to the console.

I really want to install a default error handler.
-- 
Thomas Gfüllner             Linux Information Systems AG
Software Engineer           Fon +49 (0)89 99 34 12-25     Stefan-George-Ring 24
T.Gfuellner at Linux-AG.com    Fax +49 (0)89 99 34 12-99     D-81929 München




More information about the PyQt mailing list