'ValueError: unknown locale: UTF-8' problem in Mac OS X 10.5 Leopard [solved (more or less)]

Jay Soffian jaysoffian+hg at gmail.com
Sun Oct 28 20:01:23 CDT 2007


> I'm not an expert, but that doesn't appear to be a valid value for
> LANG. It needs to consist of a language code optionally followed by a
> "." and an encoding. Not just an encoding.

Indeed.  With 2.4:

callisto:~% env - LANG=UTF-8 /opt/local/bin/python -c 'import
sys,locale; print sys.version; print locale.getdefaultlocale()'
2.4.4 (#1, Oct 26 2007, 00:01:28)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)]
(None, 'mac-roman')

With 2.5:

callisto:~% env - LANG=UTF-8 /usr/bin/python -c 'import sys,locale;
print sys.version; print locale.getdefaultlocale()'
2.5.1 (r251:54863, Oct  5 2007, 21:08:09)
[GCC 4.0.1 (Apple Inc. build 5465)]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
line 441, in getdefaultlocale
    return _parse_localename(localename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py",
line 373, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

j.


More information about the Mercurial mailing list