pybabel: default locale is None ???

Nagy László Zsolt gandalf at shopzeus.com
Tue Nov 17 03:24:41 EST 2015


Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64
bit (AMD64)] on win32
>>> from datetime import timedelta
>>> from babel.dates import format_timedelta
>>> td = timedelta(seconds=39.28355172422679)
>>> format_timedelta(td)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python35\lib\site-packages\babel\dates.py", line 779, in
format_timedelta
    plural_form = locale.plural_form(value)
AttributeError: 'NoneType' object has no attribute 'plural_form'
>>> from babel.core import default_locale
>>> repr(default_locale('LC_CTIME'))
'None'


Why? The default_locale documentation tells this:

"Returns the system default locale for a given category, based on
environment variables."





More information about the Python-list mailing list