#59 Plugin fails to load with Python 2.6

Adam Schreiber


Binary package hint: gedit-latex-plugin

When loading gedit in 32-bit Jaunty, the gedit-latex-plugin does not load:

The following message is displayed in the terminal:

ImportError: Import by filename is not supported.

** (gedit:22606): WARNING **: Error loading plugin 'Gedit LaTeX Plugin 0.2 rc1'


  • Tobias

    Same here. Also on Ubuntu Jaunty.

    Ubuntu moved to Python 2.6 recently. There is also the most recent Gedit in the distribution.

    python | 2.6.1-0ubuntu3
    gedit | 2.25.8-0ubuntu1

  • Why doesn't this have an elevated priority?

    The plugin was included in Ubuntu Jaunty (universe) as a package. It will reflect badly when it doesn't work at all.

  • I also suffer from this probem, here is my stack trace:
    Traceback (most recent call last):
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/base/decorators.py", line 621, in _on_load
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/base/decorators.py", line 673, in _adjust_editor
    editor_class.__init__(self._editor, self, file)
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/base/__init__.py", line 358, in __init__
    self.init(file, self._window_context)
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/editor.py", line 100, in init
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/editor.py", line 288, in __parse
    expander.expand(self._document, master_file, self, self.charset)
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/expander.py", line 56, in expand
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/expander.py", line 83, in _expand
    fragment = self._document_cache.get_document(File(filename), self._charset, self._issue_handler)
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/cache.py", line 130, in get_document
    entry = self.Entry(file, charset)
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/cache.py", line 72, in __init__
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/latex/cache.py", line 93, in synchronize
    self.__mtime = self.__file.mtime
    File "/usr/lib/gedit-2/plugins/GeditLaTeXPlugin/src/base/__init__.py", line 1094, in mtime
    return getmtime(self.path)
    File "/usr/lib/python2.6/genericpath.py", line 54, in getmtime
    return os.stat(filename).st_mtime
    OSError: [Errno 2] Aucun fichier ou dossier de ce type: '/home/falleri/work/ft/meetings/tache5/rapport-intro.tex.tex'

  • Ok, from what I have seen, the problem comes from latex/expander.py and more specifically from the expand method.

    The following lines:
    71 if target[0] == "/":
    72 filename = "%s.tex" % target
    73 else:
    74 filename = "%s/%s.tex" % (self._master_file.dirname, target)

    store the value "myfile.tex.tex" in the variable filename instead of "myfile.tex"...

    Hope it will help to resolve the issue!

  • I patched Ubuntu package of gedit-latex-plugin in order to make it work.

    python2.6 doesn't support import through calling of:
    while worked in python2.5.

    That's the patch included in the Ubuntu package:

    $ cat 03_changes_for_python26.patch
    diff -Naur gedit-latex-plugin-0.2rc1.orig/GeditLaTeXPlugin/__init__.py gedit-latex-plugin-0.2rc1.dest/GeditLaTeXPlugin/__init__.py
    --- gedit-latex-plugin-0.2rc1.orig/GeditLaTeXPlugin/__init__.py 1970-01-01 01:00:00.000000000 +0100
    +++ gedit-latex-plugin-0.2rc1.dest/GeditLaTeXPlugin/__init__.py 2009-03-25 15:52:20.000000000 +0100
    @@ -0,0 +1,2 @@
    +from src import *
    diff -Naur gedit-latex-plugin-0.2rc1.orig/GeditLaTeXPlugin.gedit-plugin gedit-latex-plugin-0.2rc1.dest/GeditLaTeXPlugin.gedit-plugin
    --- gedit-latex-plugin-0.2rc1.orig/GeditLaTeXPlugin.gedit-plugin 2009-03-25 16:01:16.000000000 +0100
    +++ gedit-latex-plugin-0.2rc1.dest/GeditLaTeXPlugin.gedit-plugin 2009-03-25 15:52:06.000000000 +0100
    @@ -1,5 +1,5 @@
    [Gedit Plugin]
    Name=Gedit LaTeX Plugin 0.2 rc1

    • priority: 5 --> 9
    • assigned_to: nobody --> m_zeising
    • summary: gedit-latex-plugin will not load --> Plugin fails to load with Python 2.6
    • status: open --> closed-fixed
  • Thanks for your help, the issue is fixed in SVN (remember to update your .gedit-plugin file)