Error saving bibtex files

Bug #1021245 reported by Michiel Renger
60
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Gedit Latex Plugin
Fix Released
Medium
gedit-latex-plugin (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Gedit gives the error below everytime I try to save a .bib-file. The saving seem to work fine, apart from the error popping up. Is the plugin even supposed to do anything while saving .bib-files?

  'bibtex-error'

  Traceback (most recent call last):
  File "/usr/lib/gedit/plugins/latex/util.py", line 116, in decorated_function
  return function(*args, **kw)
  File "/usr/lib/gedit/plugins/latex/bibtex/editor.py", line 141, in __parse
  self.remove_markers("bibtex-error")
  File "/usr/lib/gedit/plugins/latex/editor.py", line 493, in remove_markers
  type_record = self._marker_types[marker_type]
  KeyError: 'bibtex-error'

I'm using Xubuntu 12.04 LTS with the 3.4.0 version of the plugin. I don't think it's related, but it may be worthwhile mentioning that I'm also experiencing this bug: https://bugs.launchpad.net/ubuntu/+source/gedit-plugins/+bug/957924.

description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gedit-plugins (Ubuntu):
status: New → Confirmed
Revision history for this message
Michiel Renger (dingenis) wrote :

It may be more related to gedit then to the plugin: I notice that gedit does not clean up temporary files (starting with ~ ) properly after closing.

Revision history for this message
Sam M (loresat-laimto) wrote :

The plugin appears to be attempting to clear a marker "bibtex-error" that doesn't exist.

Change /usr/lib/gedit/plugins/latex/editor.py", line 493 to check whether a key actually exists or not before trying to remove it.

Insert:
        if (not marker_type in self._marker_types.keys()):
                type_record.markers = []
                return

Before line 493:
type_record = self._marker_types[marker_type]

This appears to fix the problem for me... I don't actually know how the markers are supposed to function, or why the plugin tries to clear one that doesn't exist. I assume they are related to the information that gedit displays in the bottom panel.

Revision history for this message
Sam M (loresat-laimto) wrote :

Oh... the line:
type_record.markers = []
Probably shouldn't be there?
But it doesn't seem to break anything.

Revision history for this message
Sam M (loresat-laimto) wrote :

Yes, it shouldn't be there, or whatever type_record was previously will get reset, which is probably a bad thing. Apologies for being hasty.

Revision history for this message
Sam M (loresat-laimto) wrote :

Ok, after fixing that, I started to get other error messages about attributes not existing, etc.
It seems the function BibTexEditor._parse() is generally broken. So I have removed the call to _parse() in BibTexEditor.onsave

Comment out line 92 in /usr/lib/gedit/plugins/latex/bibtex/editor.py

Now the file saves; but you get no warning or error messages if there is a problem with your file.

Revision history for this message
LaunchPeter (launchpeter) wrote :

The bug is still there in quantal. The workaround from #3 doesn't work, but #6 does.

Revision history for this message
Carnë Draug (carandraug) wrote :

Hi

this bug has been fixed upstream , see https://bugzilla.gnome.org/show_bug.cgi?id=667096

To apply the fix, you can edit the file /usr/lib/gedit/plugins/latex/bibtex/views.py with the changes on http://git.gnome.org/browse/gedit-latex/commit/?id=f750fe41a5e36e487e718d893b8aba5bee522444

Basically, replace None with [] on line 58.

Changed in gedit-plugins (Ubuntu):
status: Confirmed → Fix Committed
Jeremy Bícha (jbicha)
Changed in gedit-plugins (Ubuntu):
status: Fix Committed → Fix Released
Jeremy Bícha (jbicha)
affects: gedit-plugins (Ubuntu) → gedit-latex-plugin (Ubuntu)
Changed in gedit-latex-plugin (Ubuntu):
importance: Undecided → Medium
status: Fix Released → Triaged
Changed in gedit-latex-plugin:
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.