Commit 236355c
pyplot: Fix exception in
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_backend_selection during import1 parent f9feefe commit 236355c
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
0 commit comments