PySide6.7 is majorly broken - TypeErrors everywhere
-
I was developing my app using pyside6 on windows and didnt pay attention to the version, when 6.7 came out yesterday (Apr 9th) my app broke (i think my pip packages auto update) spitting out TypeError everywhere, for example not even this would run:
from PySide6.QtCore import * from PySide6.QtWidgets import * import sys app = QApplication([]) window = QMainWindow() central_widget = QFrame() window.setCentralWidget(central_widget) sys.exit(app.exec())
With the error being:
TypeError: 'PySide6.QtWidgets.QMainWindow.setCentralWidget' called with wrong argument types: PySide6.QtWidgets.QMainWindow.setCentralWidget(QFrame) Supported signatures: PySide6.QtWidgets.QMainWindow.setCentralWidget(PySide6.QtWidgets.QWidget)
Changing
QFrame
toQWidget
doesnt cause an error.
I spun up a quick windows 10 sandbox instance with pyside6.7 and got the same error, the previous release works as expected.
-
@JonB This issue is very repeatable and i think it happens with every type, basically if you dont pass the exact type a function asks for then you'll get that error, for example this too will error:
from PySide6.QtCore import * from PySide6.QtWidgets import * import sys app = QApplication([]) window = QMainWindow() central_widget = QWidget() layout = QGridLayout() central_widget.setLayout(layout) # here window.setCentralWidget(central_widget) sys.exit(app.exec())
Error:
TypeError: 'PySide6.QtWidgets.QWidget.setLayout' called with wrong argument types: PySide6.QtWidgets.QWidget.setLayout(QGridLayout) Supported signatures: PySide6.QtWidgets.QWidget.setLayout(PySide6.QtWidgets.QLayout)
I am new to qt forums and would rather someone else make the bug report if possible 😅 . Could you do it? If not please link me to the bug report and i'll give it a shot.
-
@SGaist Hello and thanks for the welcome!
So it looks it's not the wildcards import, it's the act of importing
PySide6.QtCore
.As in this would TypeError at
setCentralWidget
:from PySide6.QtCore import * from PySide6.QtWidgets import * import sys app = QApplication([]) window = QMainWindow() central_widget = QFrame() window.setCentralWidget(central_widget) sys.exit(app.exec())
and this wont:
from PySide6.QtWidgets import * import sys app = QApplication([]) window = QMainWindow() central_widget = QFrame() window.setCentralWidget(central_widget) sys.exit(app.exec())
I reported the issue here
-
@T0Mtom
Yes. If you followed @Aspecky's link to the bug report they created you will see it links on to https://bugreports.qt.io/browse/PYSIDE-2674Passes on 6.6.3.1 but fails on 6.7.0.
So they are aware! The problem/solution/workaround is that you either must not use
from ... import *
or you have to be careful about the order of such statements and how that relates to other non-*
imports. Doubtless until they fix.