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

Conversion fails when dbf file contains numbers stored in scientific notation #46

Open
vavalomi opened this issue Feb 6, 2024 · 0 comments

Comments

@vavalomi
Copy link

vavalomi commented Feb 6, 2024

I don't know how the original file was generated but according to the internet, a dbf file may contain numbers stored in scientific notation.
In such cases, the following error can be observed:

ValueError: invalid literal for int() with base 10: b'1.E+3'

This is coming from retrieve_numeric() function from tables.py, and can be fixed by wrapping the string in float() before converting to int:

        if fielddef[DECIMALS] == 0:
            return string and int(float(string)) or 0
        else:
            return string and float(string) or 0.0
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

1 participant