Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Expected 4 or 5 arguments, got 3. #375

Open
jdorr opened this issue Sep 26, 2022 · 1 comment
Open

TypeError: Expected 4 or 5 arguments, got 3. #375

jdorr opened this issue Sep 26, 2022 · 1 comment

Comments

@jdorr
Copy link
Contributor

jdorr commented Sep 26, 2022

When compiling ui files using pyside2-uic (PySide-5.15.4), QtCompat.translate() will sometimes have 3 arguments:
QtCompat.translate("MainWindow", u"MainWindow", None)
When executing our program, TypeError is raised:

  File "/dd/shows/DEV01/user/work.akelada/tools/cent7_64/package/launchpad/0.1.2/python/launchpad/Ui_launchpad_UI.py", line 205, in retranslateUi
    MainWindow.setWindowTitle(QtCompat.translate("MainWindow", u"MainWindow", None))
  File "/dd/tools/cent7_64/package/qt_py/1.3.6/python/Qt.py", line 844, in _translate
    "Expected 4 or 5 arguments, got {0}.".format(len(args) + 2))
TypeError: Expected 4 or 5 arguments, got 3.

I believe a fix should be made to _translate() as it is forcing us to use a certain number of arguments even though in the original methods, some arguments are optional:
https://doc.qt.io/qtforpython-5/PySide2/QtCore/QCoreApplication.html#PySide2.QtCore.PySide2.QtCore.QCoreApplication.translate

Also:
pyside2-uic foo.ui --> QCoreApplication.translate("MainWindow", u"MainWindow", None) (pyside-5.15.4)
pyside2-uic foo.ui --> QCoreApplication.translate("MainWindow", u"MainWindow", None, -1) (pyside-5.12.6)

@mottosso
Copy link
Owner

So long as this also applies to Qt 4 then a PR is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants