I'm trying to package an app to /opt, but when installed the app won't run and complains:

Traceback (most recent call last):
 File "/opt/extras.ubuntu.com/drawers/bin/drawers", line 45, in <module>
    import drawers
  File "/opt/extras.ubuntu.com/drawers/drawers/__init__.py", line 21, in <module>
    locale.bindtextdomain('drawers', '/opt/extras.ubuntu.com/drawers/share/locale')
NameError: name 'locale' is not defined

I can't figure out what I need to change. Is there a config file I need to alter?


It seems to me that your application doesn't contain any internationalized strings (internationalized with gettext helper: _(). So no local is produced to the targeted system as there is nothing to translate!

See http://docs.python.org/library/gettext.html for my information on gettext frmo python.

If your application doesn't contain any strings that you present to the user, you can remove the locale.bindtextdomain command in drawers/init.py

  • Thanks for your help... There actually isn't locale.bindtext command in the quickly template. Just deleting these lines from init.py worked: import gettext from gettext import gettext as _ gettext.textdomain('drawers') Note that commenting them out isn't good enough, they get replaced with the actual locale command text when packaged via quickly package --extras (not regular package). – Ian B. Jul 9 '12 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.