meld crashes with AttributeError on startup

Bug #250525 reported by Trevor Caira
42
This bug affects 3 people
Affects Status Importance Assigned to Milestone
meld
Fix Released
High
meld (Debian)
Fix Released
Unknown
meld (Ubuntu)
Fix Released
Undecided
Adam Collard

Bug Description

Binary package hint: meld

meld crashes immediately on starting the application. This breaks tools which try to use it as a merge tool for resolving conflicts.

Traceback (most recent call last):
  File "/usr/bin/meld", line 93, in <module>
    import meldapp
  File "/usr/lib/meld/meldapp.py", line 58, in <module>
    class NewDocDialog(gnomeglade.Component):
  File "/usr/lib/meld/meldapp.py", line 60, in NewDocDialog
    TYPE = misc.struct(DIFF2=0, DIFF3=1, DIR2=2, DIR3=3, VC=4)
AttributeError: 'module' object has no attribute 'struct'

using version 1.1.5.1-2ubuntu1.

$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04

Revision history for this message
Adam Collard (adam-collard) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I suspect there is another Python module named "misc" somewhere on your system.

To help confirm this, could you open a Terminal (Applications -> Accessories -> Terminal) and type the following command:

python -c "import misc; print misc.__file__"

and paste the output in here.

Revision history for this message
Adam Collard (adam-collard) wrote :

Reproducible with an empty misc.py file in the python search path.

Changed in meld:
assignee: nobody → adam-collard
status: New → Confirmed
Revision history for this message
Trevor Caira (trevor-caira) wrote :

Yes, you were correct. That was the issue. Now I am just noticing that it wasn't an AssertionError, but an AttributeError. Whoops.

I suppose that is the danger of relative imports. Perhaps the application could be rewritten to use absolute imports instead, in case someone has `misc`, `tree`, `paths`, etc. modules in their python path? Any of those would cause meld to crash similarly.

Revision history for this message
Michael Budde (mbudde) wrote :

A new upstream release have been uploaded to Jaunty archives. Please test the new version and report if this bug still reproducible.

Revision history for this message
VinceLe (legoll) wrote :

None of the problematic files have been renamed, so the bug should still be there...

Revision history for this message
Adam Collard (adam-collard) wrote :

Found the bug in Debian, which they've fixed by putting the Meld directory at the start of sys.path rather than at the end (preferring all of Meld's internals to other packages installed on the system).

Is fixed in 1.2.1-1

Changed in meld:
importance: Undecided → Unknown
status: New → Unknown
Revision history for this message
Adam Collard (adam-collard) wrote :

Oops other upstream bug was a duplicate

Changed in meld:
status: Unknown → In Progress
Revision history for this message
VinceLe (legoll) wrote :

I just committed the upstream fix in meld git HEAD.

But I cannot update this bug's status, so I'll let someone who can handle it.

Revision history for this message
Guillermo Aguilar (ga-aguilar) wrote :

$ meld
Traceback (most recent call last):
  File "/usr/bin/meld", line 38, in <module>
    gettext.bindtextdomain("meld", paths.locale_dir())
AttributeError: 'module' object has no attribute 'locale_dir'

$ python -c "import misc; print misc.__file__"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named misc

$ lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04

bug still in jaunty official package :s
:S :S

Revision history for this message
VinceLe (legoll) wrote :

Yes you'll have to get upstream git source code from the git repository if you want the fix, the jaunty version is still the old one...

Changed in meld:
status: In Progress → Fix Released
Revision history for this message
eMancu (emiliano.mancuso) wrote :

In bug #360097 (https://bugs.launchpad.net/ubuntu/+source/meld/+bug/360097)

VinceLe said:
edit /usr/bin/meld, at line 32, you should see something like:
sys.path += [ "/usr/lib/meld" ]
try to replace the line with:
sys.path[0:0] = [ "/usr/lib/meld" ]

-----------------------------------------------------------------------------------------

Well.. i do what he said and it works!
I know that the bug has a "Fix Released" status, but i think that is important to write a comment.

Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

Hi,

This will be fixed in Karmic, with version 1.3.0-1

Changed in meld (Ubuntu):
status: Confirmed → Fix Released
Changed in meld:
importance: Unknown → High
Changed in meld (Debian):
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.