You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyplot: Fix exception in _backend_selection during import
if the new style introspection GObject python bindings are in use. With
pygobject >= 3.13.4 the following:
from gi.repository import GObject
from matplotlib import pyplot
causes an exception to be raised:
> AttributeError: When using gi.repository you must not import static modules
> like "gobject". Please change all occurrences of "import gobject" to "from
> gi.repository import GObject". See:
> https://bugzilla.gnome.org/show_bug.cgi?id=709183
It is not valid to use both non-introspection based and introspection based
PyGObject in the same process. Backend probing will `import gobject` (i.e. the
non-introspection bindings) if it sees that the 'gtk' module is loaded.
Unfortunately it wouldn't check if this was the pygi or old-style gtk module.
This commit adds this check avoiding the exception.
This check was added to PyGObject in [d704033][1]
[1]: https://git.gnome.org/browse/pygobject/commit/?id=d704033
0 commit comments