Unknown locale error for Malayalam language in Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maxinbjohn

    #1

    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.getdefau ltlocale()


    It throws the following error :

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

    Thanks in advance.

    Maxin B. John
  • Jeroen Ruigrok van der Werven

    #2
    Re: Unknown locale error for Malayalam language in Python

    -On [20080227 06:03], maxinbjohn (maxinbjohn@gma il.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...

    Comment

    • Terry Reedy

      #3
      Re: Unknown locale error for Malayalam language in Python


      "maxinbjohn " <maxinbjohn@gma il.comwrote in message
      news:8675c4a8-7a56-4c71-aa97-23842d9c6bc4@u1 0g2000prn.googl egroups.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.getdefau ltlocale()
      |
      |
      | It throws the following error :
      |
      | Traceback (most recent call last):
      | File "test.py", line 4, in ?
      | print locale.getdefau ltlocale()
      | File "/usr/local/lib/python2.4/locale.py", line 346, in
      | getdefaultlocal e
      | return _parse_localena me(localename)
      | File "/usr/local/lib/python2.4/locale.py", line 278, in
      | _parse_localena me
      | 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



      Comment

      Working...