Opened 4 years ago

Closed 4 years ago

#17649 closed Bug (duplicate)

Creating superuser generates exception when system locale is not set

Reported by: chomik Owned by: nobody
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: chomik Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When trying to create superuser with system locale not set (either when syncing db for the first time or invoking createsuperuser) an exception is rised:

Traceback (most recent call last):
  File "../", line 9, in <module>
  File "/Users/neaf/sprint/django/django/core/management/", line 419, in execute_from_command_line
  File "/Users/neaf/sprint/django/django/core/management/", line 358, in execute
  File "/Users/neaf/sprint/django/django/core/management/", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/neaf/sprint/django/django/core/management/", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/neaf/sprint/django/django/contrib/auth/management/commands/", line 63, in handle
    default_username = get_default_username()
  File "/Users/neaf/sprint/django/django/contrib/auth/management/", line 105, in get_default_username
    default_username = get_system_username()
  File "/Users/neaf/sprint/django/django/contrib/auth/management/", line 85, in get_system_username
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None

Attachments (2)

ticket17649.patch (1.5 KB) - added by chomik 4 years ago.
suggested solution
ticket17649_2.patch (1.5 KB) - added by chomik 4 years ago.
test improvement

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by chomik

suggested solution

Changed 4 years ago by chomik

test improvement

comment:1 Changed 4 years ago by chomik

  • Cc chomik added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by neaf

  • Component changed from Uncategorized to contrib.auth
  • Triage Stage changed from Unreviewed to Ready for checkin
  • Type changed from Uncategorized to Bug

comment:3 Changed 4 years ago by lrekucki

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16017, #17185, #17022.

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