ValueError: unknown locale: UTF-8

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

    ValueError: unknown locale: UTF-8

    On OS X 10.5.2 :

    $ python
    Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13)
    [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
    Type "help", "copyright" , "credits" or "license" for more information.
    >>import locale
    >>locale.getdef aultlocale()
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/System/Library/Frameworks/Python.framewor k/Versions/2.5/lib/
    python2.5/locale.py", line 441, in getdefaultlocal e
    return _parse_localena me(localename)
    File "/System/Library/Frameworks/Python.framewor k/Versions/2.5/lib/
    python2.5/locale.py", line 373, in _parse_localena me
    raise ValueError, 'unknown locale: %s' % localename
    ValueError: unknown locale: UTF-8
    >>>
    This is on open bug or is there more to it?

    Regards, mario
  • Arnaud Delobelle

    #2
    Re: ValueError: unknown locale: UTF-8

    Mario Ruggier <mario@ruggier. orgwrites:
    On OS X 10.5.2 :
    >
    $ python
    Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13)
    [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
    Type "help", "copyright" , "credits" or "license" for more information.
    >>>import locale
    >>>locale.getde faultlocale()
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/System/Library/Frameworks/Python.framewor k/Versions/2.5/lib/
    python2.5/locale.py", line 441, in getdefaultlocal e
    return _parse_localena me(localename)
    File "/System/Library/Frameworks/Python.framewor k/Versions/2.5/lib/
    python2.5/locale.py", line 373, in _parse_localena me
    raise ValueError, 'unknown locale: %s' % localename
    ValueError: unknown locale: UTF-8
    >>>>
    >
    This is on open bug or is there more to it?
    >
    Regards, mario
    Works for me (10.5.3):

    marigold:~ arno$ uname -srv
    Darwin 9.3.0 Darwin Kernel Version 9.3.0: Fri May 23 00:49:16 PDT 2008; root:xnu-1228.5.18~1/RELEASE_I386
    marigold:~ arno$ python -c "import locale; print locale.getdefau ltlocale()"
    ('en_GB', 'UTF8')

    --
    Arnaud

    Comment

    • =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

      #3
      Re: ValueError: unknown locale: UTF-8

      ValueError: unknown locale: UTF-8
      >>>>
      >
      This is on open bug or is there more to it?
      Do you have an environment variable set who is named
      either LANG or starts with LC_?

      Regards,
      Martin

      Comment

      • mr

        #4
        Re: ValueError: unknown locale: UTF-8

        On Jun 1, 8:43 pm, "Martin v. Löwis" <mar...@v.loewi s.dewrote:
        ValueError: unknown locale: UTF-8
        >
        This is on open bug or is there more to it?
        >
        Do you have an environment variable set who is named
        either LANG or starts with LC_?
        Actually, yes:

        LC_CTYPE=UTF-8

        where is it coming from? This is basically on a clean new machine...
        who might be setting it? It is coming from a program elsewhere on the
        system? How should python code deal with this?

        Thanks! mario

        Comment

        • =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

          #5
          Re: ValueError: unknown locale: UTF-8

          Actually, yes:
          >
          LC_CTYPE=UTF-8
          >
          where is it coming from? This is basically on a clean new machine...
          who might be setting it?
          There are many possible places. grep in your Library, as a starting
          point. As on Macintosh lists.
          It is coming from a program elsewhere on the
          system? How should python code deal with this?
          Python should do what it does: just crash. This setting is not supported.

          Regards,
          Martin

          Comment

          Working...