Hi,
I’m trying to run Qt according to the scripts given in the book, for example tableview_tablemodel.py and following.
It doesn’t work at all, it crashes on db.open()
After searching the forums, the solution came from creating a QCoreApplication object before doing anything else. typically,
from PyQt6.QtCore import QCoreApplication
app = QCoreApplication()
But I’m only half satisfied with this because I don’t know what to do with this object afterwards.
All other parameters are correct: file rights, directories, distribution, etc…
If I create a blank venv with only PyQt6, it’s all the same.
I’m running Win11, Py3.12
My chinook.sqlite source is correct, and the same thing happens with a more basic script and an addDatabase
At runtime, I get the error Process finished with exit code -1073741819 (0xC0000005)
Any ideas?
Regards
@Rodrigue, Usually this means C++ code crash. But reason can be really hard to detect. Did you try really simple app just QLabel
and CentralWidget
?
Can you try PyQt6 and PySide6?
import sys
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.label = QLabel("Hello, PySide6!", self)
self.label.setGeometry(50, 50, 200, 40)
self.setWindowTitle("PySide6 QLabel Example")
self.setGeometry(300, 300, 300, 200)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())