Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing dates #46

Open
fccoelho opened this issue Nov 12, 2020 · 1 comment
Open

Error parsing dates #46

fccoelho opened this issue Nov 12, 2020 · 1 comment

Comments

@fccoelho
Copy link

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.

@olemb
Copy link
Owner

olemb commented Dec 21, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants