[PyQt] Python Aborted (core dumped) error

Phil Thompson phil at riverbankcomputing.com
Sat Aug 1 15:27:02 BST 2015


On 01/08/2015 3:19 pm, John Thorp wrote:
> I am having issues with python crashing when exceptions are raised
> inside a QTimer callback. Below is a small example showing this
> 
> import sys
> from PyQt5.QtCore import (QTimer, pyqtSlot)
> from PyQt5.QtWidgets import (QMainWindow, QApplication)
> 
> class MainWindow (QMainWindow):
> 
>     def __init__(self):
>         QMainWindow.__init__(self)
> 
>         self.timer = QTimer(self)
>         self.timer.timeout.connect(self.timer_call)
>         self.timer.start(1000)
> 
>     @pyqtSlot()
>     def timer_call(self):
>         print ("Called")
>         x={}
>         x[2]
> 
> app = QApplication(sys.argv)
> main = MainWindow()
> main.show()
> 
> sys.exit(app.exec_())
> 
> When run this shows the following:
> 
> Called Traceback (most recent call last): File "gtscan.py", line 21,
> in timer_call x[2] KeyError: 2
> Aborted (core dumped)
> 
> Version of software used are (all from Arch Linux builds):
> 
> Python 3.4.3
> Qt version: 5.5.0
> PyQt version: 5.5
> SIP version: 4.16.9
> 
> Can anyone help this please - it is not the KeyError I am looking for
> help on - it is why this causes the python Aborted (core dumped)
> error.

As of PyQt v5.5 unhandled exceptions result in a call to qFatal(), 
see...

http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#pyqt-v5-5

Phil


More information about the PyQt mailing list