-
Notifications
You must be signed in to change notification settings - Fork 91
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
ValueError: Unknown field type: '\x00' #17
Comments
This is either a corrupt file or a field type I haven't come across before. If it's a new field type the first step is to find out what's in the fields. You can do this by adding a custom field parser for the
This will print out the data in every NAME b'Bob ' The next step is to figure out how to parse the data (or just leave it as a binary string). |
Hi, I am having the same issue on a .dbf file and I ran the code above to identify the problematic field. Traceback (most recent call last):
File "test_dbf_field.py", line 14, in <module>
main(sys.argv[1])
File "test_dbf_field.py", line 9, in main
dbf = DBF(fname, parserclass=TestFieldParser, encoding='iso-8859-1')
File "/usr/local/lib/python3.6/dist-packages/dbfread/dbf.py", line 123, in __init__
self._check_headers()
File "/usr/local/lib/python3.6/dist-packages/dbfread/dbf.py", line 265, in _check_headers
raise ValueError('Unknown field type: {!r}'.format(field.type))
ValueError: Unknown field type: 'ÿ' Libreoffice Calc is able to open this file without any problem. I investigated a little further to see if the dbf had been altered by opening and saving it on a spreadsheet such as Excel (i've seen this happen before). I inspected the dbf with
for comparison, here is
This tells me that this dbf has been tampered with and re-saved. Do you suggest any way to handle this without having the original file recreated? |
It's hard to say what has happened in the file. You could try to open it in a hex editor and see what it looks like. A normal DBF file should look something like this (
The file has:
If you see something that doesn't look like this the file is likely corrupted. I've been wanting to write some debugging tool for these sorts of situation, and I've decided to go ahead an do it as described in issue #50. |
I have this error opening a DBF file:
The text was updated successfully, but these errors were encountered: