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

Fix for DBF failing on null dates #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

neurohn
Copy link

@neurohn neurohn commented Jan 31, 2020

edited date field parsing to handle NULL values

@olemb
Copy link
Owner

olemb commented Dec 21, 2020

Thanks!

Could you give me an example of the value you're getting? It looks to me like you could have null bytes inside the value?

Some notes:

  • There's no need to decode the value here. You can split and join bytes object.
  • Wouldn't a replace() do the same thing?
  • The out parentheses are not needed.

So this should work:

if data.replace(b'\x00', b'') == b'' or data.strip(b' 0') == b'':

Sorry if that was a lot for such a small change. :-) Just want to make sure that I get this right.

@olemb
Copy link
Owner

olemb commented Dec 21, 2020

Could you test @william-andre's fix in pull request #35? His solution is even simpler. I hope it will work for you as well.

if data.strip(b' 0\0') == b''

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

Successfully merging this pull request may close these issues.

3 participants