#19933 closed Bug (fixed)
"ValueError: unknown locale: en_NG" in Django 1.5
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Internationalization | Version: | 1.5-rc-1 | 
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | yes | UI/UX: | no | 
Description
I get the error 
ValueError: unknown locale: en_NG
after I create a new Django 1.5 project, run "python manage.py syncdb" and attempt to define a superuser. This was also a bug in Django 1.4 when it was first released but was eventually fixed.
Attachments (1)
Change History (8)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Please find the full traceback below based on including the --traceback option:
Traceback (most recent call last):
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute
    output = self.handle(*args, **options)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
    return self.handle_noargs(**options)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/sql.py", line 195, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 170, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 117, in create_superuser
    call_command("createsuperuser", interactive=True, database=db)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 161, in call_command
    return klass.execute(*args, **defaults)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute
    output = self.handle(*args, **options)
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in handle
    default_username = get_default_username()
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 161, in get_default_username
    default_username = get_system_username()
  File "/home/lanre/.virtualenvs/D1.5R/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 136, in get_system_username
    default_locale = locale.getdefaultlocale()[1]
  File "/home/lanre/.virtualenvs/D1.5R/lib/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/home/lanre/.virtualenvs/D1.5R/lib/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: en_NG
comment:3 by , 13 years ago
| Severity: | Normal → Release blocker | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
Thanks for the traceback.
Python-related bugs:
Related Django ticket: #16017
We should definitely catch ValueError in get_system_username.
comment:4 by , 13 years ago
| Has patch: | set | 
|---|
comment:6 by , 13 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
comment:7 by , 13 years ago
As you can see by comparing the patches, I chose a different fix for stable (minimal potential impact) and master (bit of refactoring).
Please run the command with the
--tracebackoption and provide the full traceback on the ticket.