[PyQt] "Abort Trap: 6" on exception on GUI thread

Patrick Stinson patrickkidd at gmail.com
Sat Feb 11 04:05:49 GMT 2017


Maxwell, thanks for the tip. After reading that it turns out all you have to do is use any custom exvepthook and it will prevent the abort call:

def no_abort(a, b, c):
    sys.__excepthook__(a, b, c)
sys.excepthook = no_abort


> On Feb 10, 2017, at 7:57 PM, Maxwell Grady <max.grady at gmail.com> wrote:
> 
> PyQt > 5.5 will always Abort when there is an unhandled exception which in this case is the TypeError as a result of the raise statement. (http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html <http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html>)
> 
> To my knowledge that behavior can't be turned off with any form of configuration. 
> 
> -Maxwell
> 
> On Fri, Feb 10, 2017 at 10:46 PM, Patrick Stinson <patrickkidd at gmail.com <mailto:patrickkidd at gmail.com>> wrote:
> Oh yes, and I’m using Qt/PyQt at 5.7.1 with python3.5
> 
>> On Feb 10, 2017, at 7:45 PM, Patrick Stinson <patrickkidd at gmail.com <mailto:patrickkidd at gmail.com>> wrote:
>> 
>> Hello!
>> 
>> Is there any way to configure PyQt5 not to trigger an abort trap when an exception is raised in the gui thread?
>> 
>> turin:pkdiagram patrick$ make run
>> Traceback (most recent call last):
>>   File "/Users/patrick/Documents/dev/pkdiagram/pkdiagram/scene.py", line 28, in mousePressEvent
>>     raise 'sdsdfsd'
>> TypeError: exceptions must derive from BaseException
>> make: *** [run] Abort trap: 6
>> turin:pkdiagram patrick$ 
>> 
>> 
>> Thank you!
>> -P
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com <mailto:PyQt at riverbankcomputing.com>
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt <https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
> 
> 
> 
> -- 
> University of New Hampshire
> Department of Physics
> Pohl Group
> DeMeritt Hall 119
> ---
> Síocháin agus Grá

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170210/fc848ad1/attachment-0001.html>


More information about the PyQt mailing list