Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b105ab2

Browse filesBrowse files
authored
Merge pull request #12929 from tacaswell/fix_gtk_failure
FIX: skip gtk backend if gobject but not pygtk is installed
2 parents 13c6d88 + a583488 commit b105ab2
Copy full SHA for b105ab2

File tree

Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed

‎lib/matplotlib/backends/_gtk3_compat.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_gtk3_compat.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@
4040

4141
if gi.__name__ == "pgi" and gi.version_info < (0, 0, 11, 2):
4242
raise ImportError("The GTK3 backends are incompatible with pgi<0.0.11.2")
43-
gi.require_version("Gtk", "3.0")
43+
try:
44+
# :raises ValueError: If module/version is already loaded, already
45+
# required, or unavailable.
46+
gi.require_version("Gtk", "3.0")
47+
except ValueError as e:
48+
# in this case we want to re-raise as ImportError so the
49+
# auto-backend selection logic correctly skips.
50+
raise ImportError from e
51+
4452
globals().update(
4553
{name:
4654
importlib.import_module("{}.repository.{}".format(gi.__name__, name))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.