Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19933 closed Bug (fixed)

"ValueError: unknown locale: en_NG" in Django 1.5

Reported by: lanre.hbs@… 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)

19933-1.diff (1.4 KB ) - added by Claude Paroz 12 years ago.
Using DEFAULT_LOCALE_ENCODING

Download all attachments as: .zip

Change History (8)

comment:1 by Claude Paroz, 12 years ago

Please run the command with the --traceback option and provide the full traceback on the ticket.

comment:2 by lanre.hbs@…, 12 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

Version 0, edited 12 years ago by lanre.hbs@… (next)

comment:3 by Claude Paroz, 12 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Thanks for the traceback.

Python-related bugs:

Related Django ticket: #16017

We should definitely catch ValueError in get_system_username.

by Claude Paroz, 12 years ago

Attachment: 19933-1.diff added

Using DEFAULT_LOCALE_ENCODING

comment:4 by Claude Paroz, 12 years ago

Has patch: set

comment:5 by Claude Paroz <claude@…>, 12 years ago

In 8e8c9b908a0fe0d2437fcf3f0378eb2a62b81986:

Fixed getting default encoding in get_system_username

Refs #19933.

comment:6 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 327c98ff08a95205919df4ae31dc633c1acec643:

[1.5.x] Fixed #19933 -- Catched ValueError in get_system_username

Thanks lanre.hbs at gmail.com for the report.

comment:7 by Claude Paroz, 12 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).

Note: See TracTickets for help on using tickets.
Back to Top