Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98911 > unrolled thread

pybabel: default locale is None ???

Started byNagy László Zsolt <gandalf@shopzeus.com>
First post2015-11-17 09:24 +0100
Last post2015-11-17 09:24 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  pybabel: default locale is None ??? Nagy László Zsolt <gandalf@shopzeus.com> - 2015-11-17 09:24 +0100

#98911 — pybabel: default locale is None ???

FromNagy László Zsolt <gandalf@shopzeus.com>
Date2015-11-17 09:24 +0100
Subjectpybabel: default locale is None ???
Message-ID<mailman.378.1447748690.16136.python-list@python.org>
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."

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web