mcm

crash at start

Bug #567726 reported by cusaro
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
mcm
Fix Released
Critical
ubersoldat

Bug Description

mcm dosen't start and i get this error (Ubuntu 9.04):

Traceback (most recent call last):
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 258, in <module>
    mcmt.show_menu()
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 177, in show_menu
    alias = self.show_menu_dialog()
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 205, in show_menu_dialog
    self.dialog_binary, '--backtitle', 'Monocaffe Connections Manager ' + get_mcm_version(), '--clear', '--menu', '"Choose an Alias to connect to"', '0', '150', menu_size
NameError: global name 'get_mcm_version' is not defined

Changed in mcm:
importance: Undecided → Critical
assignee: nobody → ubersoldat (alejandroayuso-gmail)
Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

Thanks for the report. I thought the terminal version was more stable... grrrr...

If you want to fix it, go to:

/usr/share/apps/terminal/

and edit the file terminal.py (you might need to be root)

After the imports put this:

from mcm.common.constants import *

on lines 61 and 206 change:

get_mcm_version()

with

constants.version

That's it.

I'm also attaching the fixed "terminal.py" file, so you can also download it and place it there.

Thanks again. Bye.

I shall release a new revision in a couple of weeks with much bug fixes.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

Sorry, the directory is

/usr/share/apps/mcm/terminal

And the file is mcm-terminal.py

Changed in mcm:
status: New → Fix Committed
Revision history for this message
cusaro (cusaro) wrote :

Thanks for the hint but it didn't work for me. I tried to change the file and replace it with the file you uploaded but both lead to this error:

Traceback (most recent call last):
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 259, in <module>
    mcmt.show_menu()
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 179, in show_menu
    self.connect(alias)
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 49, in connect
    conn = self.connections[alias]
KeyError: '\n'

Revision history for this message
debianite (jose74santos) wrote :

I have also replaced mcm-terminal.py with the one you provided, still, I keep getting this error:

Traceback (most recent call last):
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 32, in <module>
    from mcm.common.utils import *
  File "/usr/share/apps/mcm/common/utils.py", line 207, in <module>
    class TipsEncoder(json.JSONEncoder):
AttributeError: 'module' object has no attribute 'JSONEncoder'

Revision history for this message
Avasilcai Ovidiu (ovidiu-avasilcai) wrote :

I've just found your "wondertool", I've been looking for something like this forever. Same as cusaro I've applied the fix and also got this error (the line numbers might not match exactly cause i've done some changes)

Traceback (most recent call last):
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 257, in <module>
    mcmt.show_menu()
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 177, in show_menu
    self.connect(alias)
  File "/usr/share/apps/mcm/terminal/mcm-terminal.py", line 48, in connect
    conn = self.connections[alias]
KeyError: '\n'

Changed in mcm:
status: Fix Committed → Incomplete
status: Incomplete → Confirmed
Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

Guys, you can try loading mcm-gtk first and adding a new connection or try adding first a new connection with $mcm -a before running it. Tell me how it goes.

The problem seems to be that the data file is empty.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

debianite:

What version of Python you have installed? It's very weird since the packet 'json' is a standard library in Python (that's why I used it)

Also, older versions of Python don't support the class definitions used by 2.6.

Let me know.

Thanks all!

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

OK!

The problem you're all having is because the file ~/.local/share/mcm/mcm.xml is empty (no connections) so please try adding a new connection first with mcm -a

I'll still fix this bug.

Changed in mcm:
milestone: none → 0.9.3
Revision history for this message
debianite (jose74santos) wrote :

I have both python 2.6.5-1 and 2.5.5-2 on Debian testing amd64.
I'm I missing any python related package?
Thanks.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

debianite: Try opening a python console and type:
from json import JSONEncoder
help(JSONEncoder)

This works on 2.6.4 and 2.5.x

Maybe Debian is building Python in some different way and json is not included by default (I've never built Python from the sources, so I don't know if this is possible)

Revision history for this message
cusaro (cusaro) wrote :

ubersoldat: i can confirm that solves the proble,

Revision history for this message
Avasilcai Ovidiu (ovidiu-avasilcai) wrote :

thank you! you were right, of course.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

Cool guys, I have left the console version a little behind since the GUI takes a lot of time and I thought no one would use it. I was wrong, I promise I'll put a little effort on bringing it up to date for the next release.

Thanks and feel free to keep posting bugs and questions.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

Fixed the bug showing a nice little error explaining what to do.

Changed in mcm:
status: Confirmed → Fix Committed
Revision history for this message
debianite (jose74santos) wrote :

ubersoldat: I did what you told me and I get this:

Python 2.5.5 (r255:77872, Feb 2 2010, 00:25:36)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from json import JSONEncoder
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name JSONEncoder
>>>

I have also installed every package I could find in the repos containing python-json.
This is driving me nuts!

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

@debianite:

Ok, I got the time to read the release documentation on python 2.6 and this is what it says:

"Some significant new packages have been added to the standard library, such as the multiprocessing and json modules"

So Python 2.5 doesn't come by default with json. Try installing Python 2.6 and change the interpreter on file /usr/share/apps/mcm/bin/mcm for the correct lines pointing to python2.6

Hope this helps.

I don't know why Debian is still sticking with 2.5 after two years. Another thing you can try is installing the package "python-json" which may install the necessary module.

Or you can change to Ubuntu :-)

Revision history for this message
debianite (jose74santos) wrote :

ubersoldat:

Thanks for helping me troubleshoot this problem.
So I tried to do this:

/usr/bin/python2.6 /usr/bin/mcm

in return I get this:

File "/usr/bin/mcm", line 46
    binary=$( basename ${0} )
           ^
SyntaxError: invalid syntax

Is there a way to make your program Debian friendly?
I'm sure that many Debian users would be interested in such a useful program like this.

Revision history for this message
ubersoldat (alejandroayuso-gmail) wrote :

@debianite:

No! /usr/bin/mcm is a bash script, that why you're getting that error. I meant for you to edit it and change the lines where /usr/bin/python is called. Open /usr/bin/mcm and you'll find this:

if [ "${binary}" == "mcm" ] ; then
    /usr/bin/python ${inst_dir}/terminal/mcm-terminal.py ${@}
else
    /usr/bin/python ${inst_dir}/gtk/mcm-gtk.py &
fi

Change it like

if [ "${binary}" == "mcm" ] ; then
    /usr/bin/python2.6 ${inst_dir}/terminal/mcm-terminal.py ${@}
else
    /usr/bin/python2.6 ${inst_dir}/gtk/mcm-gtk.py &
fi

Changed in mcm:
status: Fix Committed → 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

Related questions

Remote bug watches

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