Results 1 to 2 of 2

Thread: Unable to import Gedit in a Python script

  1. #1
    Join Date
    Jun 2011
    Beans
    3

    Unhappy Unable to import Gedit in a Python script

    I am getting the following error when running a Python script:

    Code:
    christian@christian-UX430UAR:~/.local/share/gedit/plugins$ python intelligent_text_completion.py
    intelligent_text_completion.py:13: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
      from gi.repository import Gtk, GObject, Gedit, PeasGtk
    Traceback (most recent call last):
      File "intelligent_text_completion.py", line 13, in <module>
        from gi.repository import Gtk, GObject, Gedit, PeasGtk
      File "/usr/lib/python2.7/dist-packages/gi/importer.py", line 133, in load_module
        'introspection typelib not found' % namespace)
    ImportError: cannot import name Gedit, introspection typelib not found
    
    
    I tried running sudo apt-get install gedit and I also installed gtk2.0+ and gtk3.0+ and nothing seems to work. I did also ran sudo apt-get install python-gi. Interestingly, I'm able to import GObject but not Gedit:
    Code:
    christian@christian-UX430UAR:~/.local/share/gedit/plugins$ python intelligent_text_completion.py
    intelligent_text_completion.py:13: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
      from gi.repository import Gtk, GObject, Gedit, PeasGtk
    Traceback (most recent call last):
      File "intelligent_text_completion.py", line 13, in <module>
        from gi.repository import Gtk, GObject, Gedit, PeasGtk
      File "/usr/lib/python2.7/dist-packages/gi/importer.py", line 133, in load_module
        'introspection typelib not found' % namespace)
    ImportError: cannot import name Gedit, introspection typelib not found
    I have no idea what to do. Can anyone help?
    Last edited by cdelapena; October 3rd, 2020 at 04:52 PM.

  2. #2
    Join Date
    Jan 2017
    Beans
    210

    Re: Unable to import Gedit in a Python script

    That's a plugin for gedit not a script that you can run from the command line.

    Installation instructions: https://github.com/nymanjens/gedit-i...1110-or-higher

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •