[python-win32] dbi.dbDate
Robin Becker
robin at reportlab.com
Tue Feb 20 15:58:59 CET 2007
Just came across a weird problem with dbi.dbDate; it seems it is based on the
32bit time since 1970 used by python's time module. Unfortunately I have
financial data for a bunch of people with DOB <1940.
Nothing seems to blow up when I execute sql fetches, but the returned objects
behave very strangely.
eg
>>> type(objs[5].DateOfBirth)
<type 'DbiDate'>
>>> str(objs[5].DateOfBirth)
'<interactive input>\x00\x00\x00\x00\x00'
ie it seems to be producing garbage from somewhere in memory.
I'm not sure that I care to use a date system which is so limited, but surely it
should be able to detect that the date is out of range and raise some kind of
ValueError or something.
I guess an alternative would be to abandon compatibility with python's time
module and switch to datetime for the dbDate construction.
--
Robin Becker
More information about the Python-win32
mailing list