Monday, March 16, 2009

Mercurial and on Mac OS X

Get a latest Mercurial from here and... bang!

Traceback (most recent call last):
File "/usr/local/bin/hg", line 25, in
File "/Library/Python/2.5/site-packages/mercurial/", line 75, in __getattribute__
File "/Library/Python/2.5/site-packages/mercurial/", line 47, in _load
mod = _origimport(head, globals, locals)
File "/Library/Python/2.5/site-packages/mercurial/", line 93, in
_encoding = locale.getlocale()[1]
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 460, in getlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/", line 373, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

Yes, because it is, it is not XTerm. Apple had a years to add Spotlight, but had zero time to fix a bug, that is for years around: bad locale handling. To fix the bones, add into .profile this explicitly:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

...or foo_BAR about your other locale.

1 comment:

bubenkoff said...

thanks man - helped me