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 on initialization of PyQt5 QtWidgets.QApplication #276

Open
casimir7 opened this issue Jan 8, 2021 · 1 comment
Open

TypeError on initialization of PyQt5 QtWidgets.QApplication #276

casimir7 opened this issue Jan 8, 2021 · 1 comment

Comments

@casimir7
Copy link

casimir7 commented Jan 8, 2021

Hello spyder-kernels team.
Thanks for your work!
I stumbled across the following

Problem:

On my system:
Fedora 33,
Python 3.9
Spyder 4.1.5
PyQt5 5.15.0,

I cannot instantiate QApplication in Spyder. As a test case, run the following code

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
def window():
   app = QApplication(sys.argv)
   w = QWidget()
   b = QLabel(w)
   b.setText("Hello World!")
   w.setGeometry(100,100,200,50)
   b.move(50,20)
   w.setWindowTitle("PyQt5")
   w.show()
   sys.exit(app.exec_())
if __name__ == '__main__':
   window()

On execution in the IPython Shell I get the following error:

 File "/usr/lib/python3.9/site-packages/spyder_kernels/customize/spydercustomize.py", line 160, in __init__
    super(SpyderQApplication, self).__init__(*args, **kwargs)

TypeError: super(type, obj): obj must be an instance or subtype of type

The same code runs on a terminal using the standard python interpreter without problems.

Solution:

The error can be fixed by changing line 160 of spydercustomize.py from
super(SpyderQApplication, self).init(*args, **kwargs)
to
super().init(*args, **kwargs).

@impact27
Copy link
Contributor

impact27 commented Apr 1, 2021

That is strange. Maybe you have several versions of PyQt5 installed? Unfortunately we can't use super() because of python 2

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