Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ValueError: unknown locale: UTF-8

1,179 views
Skip to first unread message

Mario Ruggier

unread,
May 31, 2008, 6:57:56 AM5/31/08
to pytho...@python.org
On OS X 10.5.2 :

$ python
Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
Traceback (most recent call last):
File "<stdin>", 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
>>>

This is on open bug or is there more to it?

Regards, mario

Arnaud Delobelle

unread,
May 31, 2008, 8:01:51 AM5/31/08
to
Mario Ruggier <ma...@ruggier.org> writes:

Works for me (10.5.3):

marigold:~ arno$ uname -srv
Darwin 9.3.0 Darwin Kernel Version 9.3.0: Fri May 23 00:49:16 PDT 2008; root:xnu-1228.5.18~1/RELEASE_I386
marigold:~ arno$ python -c "import locale; print locale.getdefaultlocale()"
('en_GB', 'UTF8')

--
Arnaud

"Martin v. Löwis"

unread,
Jun 1, 2008, 2:43:54 PM6/1/08
to
> ValueError: unknown locale: UTF-8
>>>>
>
> This is on open bug or is there more to it?

Do you have an environment variable set who is named
either LANG or starts with LC_?

Regards,
Martin

mr

unread,
Jun 2, 2008, 8:18:50 AM6/2/08
to

Actually, yes:

LC_CTYPE=UTF-8

where is it coming from? This is basically on a clean new machine...
who might be setting it? It is coming from a program elsewhere on the
system? How should python code deal with this?

Thanks! mario

"Martin v. Löwis"

unread,
Jun 2, 2008, 1:43:43 PM6/2/08
to
> Actually, yes:
>
> LC_CTYPE=UTF-8
>
> where is it coming from? This is basically on a clean new machine...
> who might be setting it?

There are many possible places. grep in your Library, as a starting
point. As on Macintosh lists.

> It is coming from a program elsewhere on the
> system? How should python code deal with this?

Python should do what it does: just crash. This setting is not supported.

Regards,
Martin

0 new messages