[PyQt] PyQt5 crash on error
Kyle Altendorf
sda at fstab.net
Sat Oct 1 21:47:02 BST 2016
On 2016-10-01 14:19, Fredrik Averpil wrote:
> I recently found that an error generated by PyQt5 instantly crashes the
> application instead of just printing an error to the terminal (like
> PyQt4 and PySide does).
>
> With PySide2, the application freezes up completely instead of crashing
> on the same kind of error. I created a bug report with repro code for
> this over at the PySide project:
> https://bugreports.qt.io/browse/PYSIDE-364
For me it prints a traceback and doesn't crash. I can click again and
get another traceback. I think that there is a difference between
uncaught exceptions in normal code which will terminate the application
and uncaught exceptions in code called by slots which falls out of that
slot but doesn't crash the whole application.
kodi at kodi:~$ uname -a
Linux kodi 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux
kodi at kodi:~$ python3 --version
Python 3.5.2
kodi at kodi:~$ pip3 show pyqt5
---
Metadata-Version: 1.1
Name: PyQt5
Version: 5.7
#!/usr/bin/env python3
import sys
from PyQt5 import QtWidgets
def on_pressed():
priknt("world") # misspelled
app = QtWidgets.QApplication(sys.argv)
button = QtWidgets.QPushButton("Hello")
button.pressed.connect(on_pressed)
button.show()
app.exec_()
More information about the PyQt
mailing list