473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ValueError: unknown locale: UTF-8

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
Jun 27 '08 #1
4 6642
Mario Ruggier <ma***@ruggier.orgwrites:
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
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
Jun 27 '08 #2
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
Jun 27 '08 #3
mr
On Jun 1, 8:43 pm, "Martin v. Löwis" <mar...@v.loewis.dewrote:
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_?
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
Jun 27 '08 #4
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
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Philipp Lenssen | last post by:
I want to try the new Yahoo API, but I get the PHP5 error message Unknown encoding "utf-8" in the marked line below... (After that, applying the Xpath will fail as symptom of the first bug.) ...
6
by: Stas Z | last post by:
Hello, Just noticed that the locale 'nb_NO' is not supported in Python?! stas@mobi:~$ locale LANG=nb_NO stas@mobi:~$ python Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
8
by: davihigh | last post by:
My Friends: I am using std::ofstream (as well as ifstream), I hope that when i wrote in some std::string(...) with locale, ofstream can convert to UTF-8 encoding and save file to disk. So does...
12
by: Sachin Punjabi | last post by:
Hi, I wanted to read a file encoded in utf-8 and and using the following syntax in my source which throws me an error specifying Lookuperror : unknown encoding : utf-8. Also I am working on...
2
by: mpalomas | last post by:
Hi C++ folks, I have trouble to open files whose path contains non-ascii characters with std::ifstream. For instance let's say i just have a file which has Japanese characters either in the...
2
by: maxinbjohn | last post by:
Dear friends, I am a Python programmer from Kerala, India. When I tried to run a simple python program which uses the Malayalam language (ml), import os import locale os.environ='ml' print...
2
by: Mario Ruggier | last post by:
On OS X 10.5.2 : $ python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) on darwin Type "help", "copyright", "credits" or "license" for more information. Traceback (most recent call last):...
3
by: Mario Ruggier | last post by:
Hi, i had the following problem when installing py3.0rc1 on a Mac OS X 10.5.5. On this system, the default locale values are: $ locale LANG= LC_COLLATE="C" LC_CTYPE="UTF-8" LC_MESSAGES="C"
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.