← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1376598] [NEW] Use of _ without importing it - "NameError: name '_' is not defined"

 

Public bug reported:

To reproduce start main function in glance/glance/cmd/api.py or glance/glance/cmd/registry.py. 
There is exception in devstack:

File "/opt/stack/glance/glance/cmd/api.py", line 28, in <module>
    from glance.common import utils
  File "/opt/stack/glance/glance/common/utils.py", line 45, in <module>
    from glance.common import exception
  File "/opt/stack/glance/glance/common/exception.py", line 30, in <module>
    class GlanceException(Exception):
  File "/opt/stack/glance/glance/common/exception.py", line 38, in GlanceException
    message = _("An unknown exception occurred")
NameError: name '_' is not defined

Process finished with exit code 1

Seems to be similar to bug #885529

I think one of the possible solution (which works for me) is to  put in
glance/glance/__init__.py lines below:

from glance.openstack.common import gettextutils
gettextutils.install('glance')

Check with glance:2015.1

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1376598

Title:
  Use of _  without importing it -  "NameError: name '_' is not defined"

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

Bug description:
  To reproduce start main function in glance/glance/cmd/api.py or glance/glance/cmd/registry.py. 
  There is exception in devstack:

  File "/opt/stack/glance/glance/cmd/api.py", line 28, in <module>
      from glance.common import utils
    File "/opt/stack/glance/glance/common/utils.py", line 45, in <module>
      from glance.common import exception
    File "/opt/stack/glance/glance/common/exception.py", line 30, in <module>
      class GlanceException(Exception):
    File "/opt/stack/glance/glance/common/exception.py", line 38, in GlanceException
      message = _("An unknown exception occurred")
  NameError: name '_' is not defined

  Process finished with exit code 1

  Seems to be similar to bug #885529

  I think one of the possible solution (which works for me) is to  put
  in glance/glance/__init__.py lines below:

  from glance.openstack.common import gettextutils
  gettextutils.install('glance')

  Check with glance:2015.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1376598/+subscriptions


Follow ups

References