468,537 Members | 2,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

Unknown locale error for Malayalam language in Python

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['LANG']='ml'
print locale.getdefaultlocale()
It throws the following error :

Traceback (most recent call last):
File "test.py", line 4, in ?
print locale.getdefaultlocale()
File "/usr/local/lib/python2.4/locale.py", line 346, in
getdefaultlocale
return _parse_localename(localename)
File "/usr/local/lib/python2.4/locale.py", line 278, in
_parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: ml

Thanks in advance.

Maxin B. John
Feb 27 '08 #1
2 1518
-On [20080227 06:03], maxinbjohn (ma********@gmail.com) wrote:
>ValueError: unknown locale: ml
This is highly dependent on the operating system you are on. Last I remember
Debian, for example, required a locale package. FreeBSD already has all
locales installed, your mileage may vary.

Try ls /usr/share/locale and see if ml is even supported, you'd generally
have to use ml_IN I guess.

--
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org/ asmodai
イェルーン ラウフ*ック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
Imitation is the sincerest form of flattery...
Feb 27 '08 #2

"maxinbjohn" <ma********@gmail.comwrote in message
news:86**********************************@u10g2000 prn.googlegroups.com...
| 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['LANG']='ml'
| print locale.getdefaultlocale()
|
|
| It throws the following error :
|
| Traceback (most recent call last):
| File "test.py", line 4, in ?
| print locale.getdefaultlocale()
| File "/usr/local/lib/python2.4/locale.py", line 346, in
| getdefaultlocale
| return _parse_localename(localename)
| File "/usr/local/lib/python2.4/locale.py", line 278, in
| _parse_localename
| raise ValueError, 'unknown locale: %s' % localename
| ValueError: unknown locale: ml
|
| Thanks in advance.

If you have a question, you should say what it is.
The error message seems clear to me.
The known locales depend on the OS and C compiler.

tjr

Feb 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ksenia Marasanova | last post: by
6 posts views Thread by Stas Z | last post: by
reply views Thread by Robert | last post: by
3 posts views Thread by robert | last post: by
reply views Thread by Tom Chilton | last post: by
2 posts views Thread by Mario Ruggier | last post: by
reply views Thread by Gabriel Genellina | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.