locale UTF-8 error

666 views
Skip to first unread message

HMA

unread,
Mar 27, 2012, 12:51:31 PM3/27/12
to django...@googlegroups.com
I am following the tutorial part 2 and when creating a superuser once the login prompt is showing (after executed python manage.py run server ).  I am using python 2.7.2 for Mac OS 10.7.3, Django 1.4 and I get the following error: 

python manage.pcreatesuperuser --username=horacio --email=horac...@gmail.com
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 70, in handle
    default_username = get_default_username()
  File "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py", line 105, in get_default_username
    default_username = get_system_username()
  File "/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py", line 85, in get_system_username
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 496, in getdefaultlocale
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 428, in _parse_localename
ValueError: unknown locale: UTF-8

Has some got something similar and have a solution for this?

Thanks in advanced.

.. HMA.

Tom Evans

unread,
Mar 27, 2012, 1:08:32 PM3/27/12
to django...@googlegroups.com

"UTF-8" isn't a locale name. A locale name would look like "es_ES.UTF-8".

Run "locale -a", which should give you a list of all available locales
on your machine.

I have no idea how you change locale on OS X. On BSD, you simply set
it in your environment via .profile/.cshrc.

Cheers

Tom

Horacio Martínez Alfaro

unread,
Mar 27, 2012, 7:03:22 PM3/27/12
to django...@googlegroups.com
Thank you very much.  I edited the ~/.bash_profile file and change the LC_CTYPE env variable to a valid locale and the problem was solved.

.. HMA.





--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Reply all
Reply to author
Forward
0 new messages