Skip to content

Importing qt_compat when no Qt binding is installed fails with NameError instead of ImportError #11629

Description

@anntzer

Bug report

Bug summary

See title.

Code for reproduction

In a clean venv with matplotlib (HEAD) installed and no qt binding installed, import matplotlib.backends.qt_compat.

Actual outcome

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/antony/src/extern/matplotlib/lib/matplotlib/backends/qt_compat.py", line 197, in <module>
    QtCore.Signal = QtCore.pyqtSignal
NameError: name 'QtCore' is not defined

Expected outcome

An ImportError.

Matplotlib version

  • Operating system:
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Introduced by #11500 (I think).
#9993 fixes the issue and is ready to go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUI: QtRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions