Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Error with dbase dbf files #1

Open
paridin opened this issue Jan 29, 2015 · 1 comment
Open

Error with dbase dbf files #1

paridin opened this issue Jan 29, 2015 · 1 comment

Comments

@paridin
Copy link

paridin commented Jan 29, 2015

Hi Steelwing,

i feel confused with this part of code
in file dbfpy/header.py, line 160

             if pos != field.start:
                raise ValueError(
                    'dbf fields definition is corrupt, '
                    'fields start does not match.'
                )

using a dbase file, it returns another number, so i reviewed your dbf files included in your test folder, i saw the dbf is of Visual Foxpro right?.

I tried my own test with a dbase file, and the field.start is set with 1271005187, so in the if statement it return me a raise statement, if commented the statement does not retrieve the values of the fields because i guess the position is important to retrieve the right value, for that reason only commented the raise statement and i set the field.start with the pos variable and it works.

>>> string=b'NORMAL\x00\x00\x00\x00\x00N\x03\x00\xc2K\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> struct.unpack('< 11s c I 3B I B', string[:24])
(b'NORMAL\x00\x00\x00\x00\x00', b'N', 1271005187, 4, 0, 0, 256, 0)

Well the way to solve my problem is it:

            if pos != field.start:
                field.start = pos
                """
                raise ValueError(
                    'dbf fields definition is corrupt, '
                    'fields start does not match.'
                )
                """

i tested with the table.dbf and it works, so maybe you can include this change, to make compatible with dbf from dbase III and Visual Foxpro because the variable pos did set fine.

@steelywing
Copy link
Owner

Thanks, I look for the dBase file structure, and it look like different to FoxPro, if need to support dBase, may be need more works.

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

No branches or pull requests

2 participants