[PyQt] Exceptions in Python Implementations of Virtuals

Phil Thompson phil at riverbankcomputing.com
Wed Oct 1 08:53:10 BST 2014


On 30/09/2014 10:24 pm, Chris Colbert wrote:
> On Tue, Sep 30, 2014 at 5:06 PM, Phil Thompson 
> <phil at riverbankcomputing.com>
> wrote:
> 
>> On 30/09/2014 9:25 pm, Chris Colbert wrote:
>> 
>>> I don't think anyone in this thread has advocated silently ignoring
>>> errors.
>>> 
>> 
>> Anybody who is advocating maintaining the current behaviour as the 
>> default
>> is doing exactly that.
>> 
>> 
> How so? We still have sys.excepthook, and can redirect stdout and 
> stderr to
> a log file, email it to an app maintainer, show it in a debug panel in 
> the
> app, etc... All these things work and are in-use today.

...but they are not the default behaviour. Yes there are good 
applications that do handle this well, but most don't. What I would like 
to try and avoid is breaking those good applications.

> I also don't know how to make myself any more clear. Not once have I
> suggested that the current behavior should remain the default. I've 
> only
> maintained that hard aborting the app is the wrong choice. And once 
> again
> I'll refer to my first post:
> 
> """
> It would be nice to have an easier way than except hooks to be able to
> detect and handle these cases, and I think exploring options in that 
> space
> is worthy of discussion. But I think qFatal is certainly the wrong 
> approach
> here.
> """

You seemed to be arguing (to me at least) that the status quo was 
preferable to calling qFatal().

Of course qFatal() only aborts the application if you are using the 
default message handler. There is nothing to stop you doing exactly what 
you would do with sys.excepthook and you would also catch any calls from 
within Qt.

Phil


More information about the PyQt mailing list