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

ValueError: Field type I must have length 4 (was 0) #68

Open
DmViKe opened this issue May 8, 2023 · 1 comment
Open

ValueError: Field type I must have length 4 (was 0) #68

DmViKe opened this issue May 8, 2023 · 1 comment

Comments

@DmViKe
Copy link

DmViKe commented May 8, 2023

Hello,
I'm unsuccessfully trying to open dbf

from dbfread import DBF, FieldParser

class TestFieldParser(FieldParser):
def parse00(self, field, data):
print(field.name, data)
return data
def parseR(self, field, data):
print(field.name, data)
return data

dbf = DBF('c:/base/75.dbf', encoding='cp1251', parserclass=TestFieldParser)
for rec in dbf:
pass

Traceback (most recent call last):
File "C:\Users\Dmitry\PycharmProjects\Transit\Lib\site-packages\Transit.py", line 13, in
dbf = DBF('c:/base/75.dbf', encoding='cp1251', parserclass=TestFieldParser)
File "C:\Users\Dmitry\PycharmProjects\Transit\Lib\site-packages\dbfread\dbf.py", line 123, in init
self._check_headers()
File "C:\Users\Dmitry\PycharmProjects\Transit\Lib\site-packages\dbfread\dbf.py", line 257, in _check_headers
raise ValueError(message.format(field.length))
ValueError: Field type I must have length 4 (was 0)

What does this error mean and how to fix it?

Thanks everyone

@DmViKe
Copy link
Author

DmViKe commented May 9, 2023

I found a problem with my .dbf file.
After manual remove Field "Type" in my database by "DBF Viewer 2000" data is read correctly
But, how do i ignore this field when reading?

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