[New-bugs-announce] [issue3067] setlocale Tracebacks on unicode locale strings

vincent.chute report at bugs.python.org
Mon Jun 9 14:09:15 CEST 2008

New submission from vincent.chute <vincent.chute at onelan.co.uk>:

import locale
locale.setlocale( locale.LC_ALL, u'ja_JP.utf8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/locale.py", line 475, in setlocale
    locale = normalize(_build_localename(locale))
  File "/usr/lib/python2.5/locale.py", line 383, in _build_localename
    language, encoding = localetuple
ValueError: too many values to unpack

The problem is line 473:
    if locale and type(locale) is not type(""):

Replacing this with
     if locale and not isinstance(locale, basestring):
fixes the problem.

components: Library (Lib)
messages: 67861
nosy: vincent.chute
severity: normal
status: open
title: setlocale Tracebacks on unicode locale strings
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list