Unknown locale error for Malayalam language in Python

M

maxinbjohn

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
 
J

Jeroen Ruigrok van der Werven

-On [20080227 06:03] said:
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.
 
T

Terry Reedy

| 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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top