Skip to content

Locale.parse('zh_CN') raises a TypeError on Babel 2.0 with Python 3.3 and 3.4. #174

@jun66j5

Description

@jun66j5
Python 3.4.3 (default, Apr 13 2015, 22:30:47)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
>>> babel.__version__
'2.0'
>>> from babel.core import Locale
>>> Locale.parse('zh_CN')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/py34/lib/python3.4/site-packages/babel/core.py", line 286, in parse
    language = get_global('language_aliases').get(language, language)
  File "/venv/py34/lib/python3.4/site-packages/babel/core.py", line 58, in get_global
    _global_data = pickle.load(fileobj)
TypeError: an integer is required (got type str)
>>>

Locale.parse('zh_CN') should work and load zh_CN localedata.

On Python 2.7, it works fine.

Python 2.7.3 (default, Jun 22 2015, 19:33:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
>>> babel.__version__
'2.0'
>>> from babel.core import Locale
>>> Locale.parse('zh_CN')
Locale('zh', territory='CN', script='Hans')
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions