dbfread
dbfread copied to clipboard
Error parsing dates
While opening a dbf I got this error:
ValueError: invalid date b'24/01/20'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/dbfread/field_parser.py in parseD(self, field, data)
91 try:
---> 92 return datetime.date(int(data[:4]), int(data[4:6]), int(data[6:8]))
93 except ValueError:
ValueError: invalid literal for int() with base 10: b'24/0'
the parser is apparently spliting the date in the wrong positions.
Yes, it's expecting YYYYMMDD but getting something with slashes.
Could you run it again with DBF(filename, raw=True)
and tell me what the whole date looks like?