On Fri, Sep 14, 2012 at 10:26 AM, Bob Aalsma <overhaalsgang_24_...@me.com> wrote: > macpro1:~ bobaalsma$ locale > LANG= > LC_COLLATE="C" > LC_CTYPE="UTF-8" > LC_MESSAGES="C" > LC_MONETARY="C" > LC_NUMERIC="C" > LC_TIME="C" > LC_ALL= > macpro1:~ bobaalsma$ python -c 'import locale; print > locale.getdefaultlocale()' > > Traceback (most recent call last): > File "<string>", line 1, in <module> > > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", > line 503, in getdefaultlocale > return _parse_localename(localename) > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", > line 435, in _parse_localename > raise ValueError, 'unknown locale: %s' % localename > ValueError: unknown locale: UTF-8 > macpro1:~ bobaalsma$ LANG="nl_NL.UTF-8" python -c'import locale ; print > locale.getdefaultlocale()' > Traceback (most recent call last): > File "<string>", line 1, in <module> > > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", > line 503, in getdefaultlocale > return _parse_localename(localename) > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", > line 435, in _parse_localename > raise ValueError, 'unknown locale: %s' % localename > ValueError: unknown locale: UTF-8 >
Sorry, part of this thread went off-list. For the archives, OS X sets LC_CTYPE="UTF-8", which IMO is nonsensical. This will always make python fall over when it tries to determine the correct locale, regardless of OS > $ unset LANG ; export LC_CTYPE="UTF-8" ; python -c 'import locale; print > locale.getdefaultlocale()' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python2.7/locale.py", line 503, in getdefaultlocale return _parse_localename(localename) File "/usr/local/lib/python2.7/locale.py", line 435, in _parse_localename raise ValueError, 'unknown locale: %s' % localename ValueError: unknown locale: UTF-8 So the fix is to undo the damage, set a proper LANG environment variable so that everything is aware what the locale is, which can be done in your .bash_profile, or a number of OS X specific ways: http://apple.stackexchange.com/questions/21096/where-does-lang-variable-gets-set-in-mac-os-x http://fruitfulerrors.blogspot.co.uk/2011/01/osx-106-lcctype.html Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.