What is the import path for the ‘Gedit’ introspection package?

Ben Finney bignose at debian.org
Wed Feb 7 04:26:19 UTC 2018


Howdy all,

What is the Python import path for the ‘Gedit’ introspection package?

The Debian ‘gedit’ package installs the file
‘/usr/lib/x86_64-linux-gnu/gedit/girepository-1.0/Gedit-3.0.typelib’.
How do I then import this in Python as the ‘Gedit’ introspection
package?

For example, the statement ‘import gi.repository’ succeeds:

    >>> import gi.repository
    >>> gi.repository
    <module 'gi.repository' from '/usr/lib/python3/dist-packages/gi/repository/__init__.py'>

And the ‘GObject’ introspection package can be imported:

    >>> gi.repository.GObject
    <GObjectProxyModule <IntrospectionModule 'GObject' from '/usr/lib/x86_64-linux-gnu/girepository-1.0/GObject-2.0.typelib'>>

When I do the equivalent for ‘Gedit’ I get an error:

    >>> import gi.repository.Gedit
    Traceback (most recent call last):
      File "<frozen importlib._bootstrap>", line 888, in _find_spec
    AttributeError: 'DynamicImporter' object has no attribute 'find_spec'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3/dist-packages/gi/importer.py", line 127, in
      find_module
        'introspection typelib not found' % namespace)
    ImportError: cannot import name Gedit, introspection typelib not found

The file is installed, and example code elsewhere [0] expects it to be
importable with ‘import gi.repository.Gedit’. How do we get this working
on Debian?


[0] e.g. <URL:https://wiki.gnome.org/Apps/Gedit/PythonPluginHowTo>.

-- 
 \      “Anyone who believes exponential growth can go on forever in a |
  `\        finite world is either a madman or an economist.” —Kenneth |
_o__)                                                   Boulding, 1973 |
Ben Finney




More information about the pkg-gnome-maintainers mailing list