Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2bef93f

Browse files
committed
fix
1 parent 918f7ee commit 2bef93f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
# required, or unavailable.
2020
gi.require_version("Gtk", "3.0")
2121
# Also require GioUnix to avoid PyGIWarning when Gio is imported
22-
gi.require_version("GioUnix", "2.0")
22+
# GioUnix is platform-specific and may not be available on all systems
23+
try:
24+
gi.require_version("GioUnix", "2.0")
25+
except ValueError:
26+
# GioUnix is not available on this platform, which is fine
27+
pass
2328
except ValueError as e:
2429
# in this case we want to re-raise as ImportError so the
2530
# auto-backend selection logic correctly skips.

lib/matplotlib/backends/backend_gtk4.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
# required, or unavailable.
1919
gi.require_version("Gtk", "4.0")
2020
# Also require GioUnix to avoid PyGIWarning when Gio is imported
21-
gi.require_version("GioUnix", "2.0")
21+
# GioUnix is platform-specific and may not be available on all systems
22+
try:
23+
gi.require_version("GioUnix", "2.0")
24+
except ValueError:
25+
# GioUnix is not available on this platform, which is fine
26+
pass
2227
except ValueError as e:
2328
# in this case we want to re-raise as ImportError so the
2429
# auto-backend selection logic correctly skips.

0 commit comments

Comments
 (0)