ValueError: unknown locale: UTF-8

M

Mario Ruggier

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.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
 
A

Arnaud Delobelle

Mario Ruggier said:
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.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

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')
 
M

Martin v. Löwis

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
 
M

mr

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

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
 
M

Martin v. Löwis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top