utf-8 locale error

132 views
Skip to first unread message

Wichert Akkerman

unread,
Oct 7, 2009, 4:28:00 AM10/7/09
to python...@googlegroups.com
After upgrading a machine to the latest OSX release I got this weird error:

import babel.support
File
"/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/support.py",
line 29, in <module>
from babel.dates import format_date, format_datetime, format_time,
LC_TIME
File
"/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/dates.py", line
34, in <module>
LC_TIME = default_locale('LC_TIME')
File
"/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/core.py", line
642, in default_locale
return '_'.join(filter(None, parse_locale(locale)))
File
"/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/core.py", line
763, in parse_locale
raise ValueError('expected only letters, got %r' % lang)
ValueError: expected only letters, got 'utf-8'

Does anyone know what could cause this?

Wichert.


--
Wichert Akkerman <wic...@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.

Wichert Akkerman

unread,
Oct 7, 2009, 4:40:22 AM10/7/09
to python...@googlegroups.com
On 2009-10-7 10:28, Wichert Akkerman wrote:
>
> After upgrading a machine to the latest OSX release I got this weird error:
>
> import babel.support
> File
> "/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/support.py",
> line 29, in<module>
> from babel.dates import format_date, format_datetime, format_time,
> LC_TIME
> File
> "/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/dates.py", line
> 34, in<module>
> LC_TIME = default_locale('LC_TIME')
> File
> "/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/core.py", line
> 642, in default_locale
> return '_'.join(filter(None, parse_locale(locale)))
> File
> "/Users/wichert/Library/eggs/Babel-0.9.4-py2.6.egg/babel/core.py", line
> 763, in parse_locale
> raise ValueError('expected only letters, got %r' % lang)
> ValueError: expected only letters, got 'utf-8'
>
> Does anyone know what could cause this?

It seems that for some reason OSX 10.6 sets LC_CTYPE=utf-8, which is a
very bad thing for it to do: utf-8 is obviously not a valid locale and
Babel trips over that.

Perhaps it would make sense to make default_locale() robust against
bogus environment settings, and have it log a warning instead of blow up?

Reply all
Reply to author
Forward
0 new messages