[PyQt] Exception within Slot causes Abort
damonlynch at gmail.com
Tue Mar 22 19:01:09 GMT 2016
On Tue, Mar 22, 2016 at 11:14 PM, Phil Thompson <phil at riverbankcomputing.com
> On 22/03/2016 5:20 pm, Dave Gradwell wrote:
>> Many thanks for the input on this one.
>> I now see that PyQt is conformant with Qt’s design.
>> Maybe I can use a custom sys.excepthook (and Barry thanks for the
>> links to wb_logging.py).
> I don't mind installing one automatically in the QApplication ctor (but
> only if one hadn't already been installed). It would just display the
> traceback in a dialog and then exit.
I'm a little shy to jump in here, because I suspect others know far more
about this topic than me.
In my code at least, sometimes when there's an uncaught exception, there
can be a deluge of them (e.g. exceptions related to a QListView / Model /
Delegate etc.) If you don't want the application to automatically exit
after the user closes the message box then stopping the display of message
box too many times is critical. For now at least I handle that rather
crudely by only showing an error message via a QMessageBox if it's not been
shown before, which is determined by checking the module and line number of
If a user is going to take the time to file a bug report, I'd like to make
it as easy as possible as possible for them. Therefore I think it's nice to
show the user in the error message box where on the file system the log
files are located, by providing a URI that when clicked starts the default
file browser at that location. (In the case of my application, the
application generates detailed log files from all processes, with log
messages from child processes to the parent process being passed via 0MQ
Then there is the case of displaying an error message before QApplication
starts. Unfortunately i didn't make a note of whose project I got that idea
from, but in any case I thought it was a good one.
No doubt there are better approaches than my attempts above but so far at
least, it works for me. Any suggested improvements are most welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt