Is this an error in python-babel or am I missing something?
cl at isbd.net
cl at isbd.net
Thu Mar 17 17:32:13 EDT 2016
I am getting the following error when running some code that uses
python-sqlkit. This uses python-babel to handle dates for different
locales.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sqlkit-0.9.6.1-py2.7.egg/sqlkit/widgets/table/columns.py", line 169, in cell_data_func_cb formatted_value = self.field.format_value(value)
File "/usr/local/lib/python2.7/dist-packages/sqlkit-0.9.6.1-py2.7.egg/sqlkit/fields.py", line 1114, in format_value return dates.format_date(value, format=format or self.format, locale=self.locale)
File "/usr/lib/python2.7/dist-packages/babel/dates.py", line 569, in format_date return pattern.apply(date, locale)
File "/usr/lib/python2.7/dist-packages/babel/dates.py", line 892, in apply return self % DateTimeFormat(datetime, locale)
File "/usr/lib/python2.7/dist-packages/babel/dates.py", line 889, in __mod__ return self.format % other
File "/usr/lib/python2.7/dist-packages/babel/dates.py", line 948, in __getitem__ return self.format_milliseconds_in_day(num)
File "/usr/lib/python2.7/dist-packages/babel/dates.py", line 1029, in format_milliseconds_in_day self.value.minute * 60000 + self.value.hour * 3600000
AttributeError: 'datetime.date' object has no attribute 'microsecond'
I'm handling a date in my sqlite database, *not* a datetime. The
sqlkit code seems to be calling the correct method - format_date() -
in the python-babel dates.py file.
However it seems that python-babel ends up trying to hand the date
down to a method that's expecting a datetime.
I've tried searching for reports of this error but I can't see any
which makes me wonder if it's not a bug in python-babel, however if
it's not a bug then I'm confused about what has gone wrong.
Is it a bug or is sqlkit doing something wrong?
--
Chris Green
ยท
More information about the Python-list
mailing list