Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

FixAttributeError: module 'gi' has no attribute 'require_version'#30657

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletionslib/matplotlib/backends/backend_gtk3.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,18 +10,18 @@
CloseEvent, KeyEvent, LocationEvent, MouseEvent, ResizeEvent)

try:
import gi
from gi import require_version as gi_require_version
except ImportError as err:
raise ImportError("The GTK3 backends require PyGObject") from err

try:
# :raises ValueError: If module/version is already loaded, already
# required, or unavailable.
gi.require_version("Gtk", "3.0")
gi_require_version("Gtk", "3.0")
# Also require GioUnix to avoid PyGIWarning when Gio is imported
# GioUnix is platform-specific and may not be available on all systems
try:
gi.require_version("GioUnix", "2.0")
gi_require_version("GioUnix", "2.0")
except ValueError:
# GioUnix is not available on this platform, which is fine
pass
Expand Down
7 changes: 4 additions & 3 deletionslib/matplotlib/backends/backend_gtk4.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,18 +9,18 @@
KeyEvent, LocationEvent, MouseEvent, ResizeEvent, CloseEvent)

try:
import gi
from gi import require_version as gi_require_version
except ImportError as err:
raise ImportError("The GTK4 backends require PyGObject") from err

try:
# :raises ValueError: If module/version is already loaded, already
# required, or unavailable.
gi.require_version("Gtk", "4.0")
gi_require_version("Gtk", "4.0")
# Also require GioUnix to avoid PyGIWarning when Gio is imported
# GioUnix is platform-specific and may not be available on all systems
try:
gi.require_version("GioUnix", "2.0")
gi_require_version("GioUnix", "2.0")
except ValueError:
# GioUnix is not available on this platform, which is fine
pass
Expand All@@ -29,6 +29,7 @@
# auto-backend selection logic correctly skips.
raise ImportError(e) from e

import gi
from gi.repository import Gio, GLib, Gtk, Gdk, GdkPixbuf
from . import _backend_gtk
from ._backend_gtk import ( # noqa: F401 # pylint: disable=W0611
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp