Skip to content

Example Application Cannot be Launched with Python2 Environment #1301

@j9ac9k

Description

@j9ac9k

running python -m examples (or python -m pyqtgraph.examples depending on how you have installed pyqtgraph) will result in an error

pyqtgraph-pyqt ❯ python -m examples
Traceback (most recent call last):
  File "/Users/ogi/.zinit/plugins/pyenv---pyenv/versions/miniconda2-latest/envs/pyqtgraph-pyqt/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/ogi/.zinit/plugins/pyenv---pyenv/versions/miniconda2-latest/envs/pyqtgraph-pyqt/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/ogi/Developer/pyqtgraph/examples/__main__.py", line 159, in <module>
    run()
  File "/Users/ogi/Developer/pyqtgraph/examples/__main__.py", line 154, in run
    app = App([])
  File "/Users/ogi/Developer/pyqtgraph/examples/__main__.py", line 28, in __init__
    super().__init__(*args, **kwargs)
TypeError: super() takes at least 1 argument (0 given)

This is in __main__.py

class App(QtGui.QApplication):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.paletteChanged.connect(self.onPaletteChange)

There are two issues, one is the super() call, which we can easily work around with super(QtGui.QApplication, self). The second line in __init__ is a bit more troublesome, as paletteChanged is a signal present in QGuiApplication in Qt5, but as far as I can tell, there is no equivalent signal in Qt4. This should likely be implemented by safely checking if paletteChanged is an attribute of the super-class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions