Forums

python import error

Hello,

I recently started getting this error when trying to run the django management command in my console. I recently tried to merge some site changes in from a code repository that I had been working on locally. However, other than this change (which I have since reverted), nothing else has changed in my environment. Almost any python related command which I try to launch from the command line gives an error such as this one:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "/home/Beison/.virtualenvs/django152/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 4, in <module>
    from optparse import OptionParser, NO_DEFAULT
  File "/usr/lib/python2.7/optparse.py", line 418, in <module>
    _builtin_cvt = { "int" : (_parse_int, _("integer")),
  File "/usr/lib/python2.7/gettext.py", line 581, in gettext
    return dgettext(_current_domain, message)
  File "/usr/lib/python2.7/gettext.py", line 545, in dgettext
    codeset=_localecodesets.get(domain))
  File "/usr/lib/python2.7/gettext.py", line 480, in translation
    mofiles = find(domain, localedir, languages, all=1)
  File "/usr/lib/python2.7/gettext.py", line 437, in find
    for nelang in _expand_lang(lang):
  File "/usr/lib/python2.7/gettext.py", line 131, in _expand_lang
    from locale import normalize
ImportError: cannot import name normalize

I am also getting the same error when trying to run pip in my virtual environment. Any idea what might be going on and how I can fix it?

[edited by admin: formatting]

Do you have a package called locale anywhere in your codebase?

The error went away the next day just as quickly as it appeared. Not sure what the issue was. But things are working fine now.

Weird! Well, so long as it's working now.

The ghost in the machine...☺