[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] problem with exceptions within events
From:       "Truls A. Tangstad" <kerfue+pykde () herocamp ! org>
Date:       2005-02-23 20:10:30
Message-ID: 20050223201030.GA21361 () sakura ! chem ! ntnu ! no
[Download RAW message or body]

On Wed, Feb 23, 2005 at 06:55:38PM +0100, Giovanni Bajo wrote:
> Hello,
> 
> it seems that Python exceptions generated within event handlers do not get
> propagated correctly. We use a sys.excepthook to abort gracefully with a
> messagebox from our application, and this seems to work in most cases but
> not within event handlers.

I think this is by design as most event-triggers are not prepared to
handle an exception caused by an event.

I had the same problem, but after thinking about it for a while i
realized that having events propagate exceptions to the initiator
would at most times be problematic and probably cause more problems
then what would be gained by what you are trying to achieve.

Events are often sent from other threads and end up in a thread-queue
in the main thread (event/gui-thread). The gui loops through this
thread and sends events where needed. If the handler of an event
throws an exception, there's now nowhere for it to go, except causing
the event-loop to crash... which Qt (PyQt?) solves by instead printing
the exception and then ditching it.

I'm sure someone will correct me if I'm off the mark here...

-- 
Truls A. Tangstad - <kerfue+pykde@h e r o c a m p.org>

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic