Crashes on start : NameError: name '_' is not defined

Bug #1095665 reported by Mark M Lambert on 2013-01-03
94
This bug affects 19 people
Affects Status Importance Assigned to Milestone
magicicada gui
Undecided
Unassigned
magicicada (Ubuntu)
Undecided
Unassigned

Bug Description

Running on Ubuntu 12.10 64 bit
Version 0.5-0ubuntu1

When I run magicicada from command line it crashes with following output:

$magicicada
Traceback (most recent call last):
  File "/usr/bin/magicicada", line 36, in <module>
    from magicicada.gui.gtk import MagicicadaUI
  File "/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/__init__.py", line 24, in <module>
    from magicicada.gui.gtk.main import MagicicadaUI
  File "/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/main.py", line 43, in <module>
    from magicicada.gui.gtk.operations import Operations
  File "/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/operations.py", line 40, in <module>
    OPS_COMPLETED = _(u'Completed %s ago (%s)')
NameError: name '_' is not defined

Launchpad Janitor (janitor) wrote :

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

Changed in magicicada (Ubuntu):
status: New → Confirmed
Christopher Townsend (townsend) wrote :

I just ran into this on 13.04 as well w/ version 0.5-0ubuntu1.

Changed in magicicada:
status: New → Confirmed
assignee: nobody → Christopher Townsend (townsend)
status: Confirmed → In Progress
Manfred Hampl (m-hampl) wrote :

I guess there is the line

from gettext import gettext as _

missing at the beginning (~ line 30) in usr/share/pyshared/magicicada/gui/gtk/operations.py

Compare
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/magicicada/saucy/view/head:/magicicada/gui/gtk/operations.py
and
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/precise/magicicada/precise/view/head:/magicicada/gui/gtk/operations.py

Evandro P. Alves (evandro-pa) wrote :

Hi

I just added

from gettext import gettext as _

to

/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/operations.py
/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/listings.py
/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/status.py

and the problem went away

Ibuntu (ibun-do-ubuntu) wrote :

I previously commented to attest the validity of Evandro's solution. After reinstalling and reapplying the fix, I noticed that it is very important where you place:

from gettext import gettext as _

in the three files. Initially I placed them too high and Magicicada would not start. So just for clarification, open each of these three files:

/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/operations.py
/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/listings.py
/usr/lib/python2.7/dist-packages/magicicada/gui/gtk/status.py

and add the line:

from gettext import gettext as _

to each of them, right after the line:

# pylint: enable=E0611

and that should work. This is usually right above any lines saying 'import magicicada ....' but also above another import in one of the files. I have tested that as long as 'from gettext import gettext as _' is after '# pylint: enable=E0611' and before any lines that say 'import magicicada ...' in all three files, that it works.

Changed in magicicada:
status: In Progress → Confirmed
assignee: Christopher Townsend (townsend) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions