UnknownLocaleError on ubuntu 14.04

187 views
Skip to first unread message

Giovanni Gherdovich

unread,
May 21, 2014, 5:21:52 AM5/21/14
to python...@googlegroups.com, Giovanni Gherdovich
Hello,

I just upgraded to ubuntu 14.04 and
I am getting this snippet gives me an UnknownLocaleError:

-------------------------
>>> from babel import Locale
>>> Locale.parse('en_US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/babel/core.py", line 313, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'en_US'
-------------------------

(it's python 2.7)
any clue ?

My locale is en_US.UTF-8

-------------------------
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
-------------------------

Same thing if I do Locale.parse('en_US.UTF-8'):


-------------------------
>>> from babel import Locale
>>> Locale.parse('en_US.UTF-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/babel/core.py", line 313, in parse
    raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'en_US'
-------------------------

Giovanni Gherdovich

unread,
May 21, 2014, 6:18:52 AM5/21/14
to python...@googlegroups.com, Giovanni Gherdovich
Hello,



On Wed, May 21, 2014 at 11:21 AM, Giovanni Gherdovich <g.gher...@gmail.com> wrote:
>
> Hello,
>
> I just upgraded to ubuntu 14.04 and
> I am getting this snippet gives me an UnknownLocaleError:
>
> -------------------------
> >>> from babel import Locale
> >>> Locale.parse('en_US')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.7/dist-packages/babel/core.py", line 313, in parse
>     raise UnknownLocaleError(input_id)
> babel.core.UnknownLocaleError: unknown locale 'en_US'
> -------------------------

I narrowed down to

------------------------------
>>> from babel import localedata
>>> localedata.exists('en_US')
False
------------------------------

and seems babel looks for a file at '/usr/lib/python2.7/dist-packages/babel/localedata/en_US.dat' ,
which I don't have.

Still, could not solve.

Regards,
GGhh

Felix Schwarz

unread,
May 21, 2014, 8:21:56 AM5/21/14
to python...@googlegroups.com

Am 21.05.2014 11:21, schrieb Giovanni Gherdovich:
>>>> from babel import Locale
>>>> Locale.parse('en_US')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.7/dist-packages/babel/core.py", line 313, in parse
> raise UnknownLocaleError(input_id)
> babel.core.UnknownLocaleError: unknown locale 'en_US'

This works for me on Fedora 20.

But on Fedora I see this file:
/usr/lib/python2.7/site-packages/babel/localedata/en_US.dat

So you should check why en_US.dat is not present in Ubuntu (or maybe they
splitted the module and you need to install extra packages?).

fs

David Fraser

unread,
May 21, 2014, 8:56:35 AM5/21/14
to python...@googlegroups.com
On Ubuntu the files are in /usr/share/python-babel-localedata/localedata/
However I can confirm that en_US.dat is missing on 14.04 with python-babel-localedata package version 1.3+dfsg.1-2ubuntu1
(Many other locales are present including en_ZM.dat etc)

David

David Fraser

unread,
May 21, 2014, 8:59:10 AM5/21/14
to python...@googlegroups.com
Update: This is actually present in the package, so something is removing it
See http://packages.ubuntu.com/trusty/all/python-babel-localedata/filelist

David

David Fraser

unread,
May 21, 2014, 9:03:27 AM5/21/14
to python...@googlegroups.com
Perhaps I should have finished my investigation before each reply. There are bug reports about this:
https://bugs.launchpad.net/ubuntu/+source/python-babel/+bug/1299442
https://bugs.launchpad.net/ubuntu/+source/python-babel/+bug/1320612

They contain information about proposed fixes, but in the mean time:
sudo apt-get install --reinstall python-babel-localedata
will fix the issue

David

Giovanni Gherdovich

unread,
May 21, 2014, 9:51:46 AM5/21/14
to python...@googlegroups.com
Hi,


sudo apt-get install --reinstall python-babel-localedata

made the trick.

Hans van Dijk

unread,
Oct 10, 2014, 8:10:26 AM10/10/14
to python...@googlegroups.com
Hi,

It seems you helped me out, however it resulted in the advice to do: sudo apt-get -f install
Now much more python failures during ubuntu upgrade are solved.

Thnq

Op woensdag 21 mei 2014 15:51:46 UTC+2 schreef Giovanni Gherdovich:
Reply all
Reply to author
Forward
0 new messages