'python dbf - add row of dict to existing file
I have a dbf file with following structure...
FieldnameList(['ORDNUMB C(10) SYSTEM', 'SIDE C(1) BINARY SYSTEM', 'POSITION C(3)', 'COMPTYPE C(2)', 'COMPCODE C(6)', 'COMPCODEEX C(10) SYSTEM', 'CRIBTYPE C(2) BINARY SYSTEM', 'DIAM1 C(2)', 'DIAM2 C(2)', 'DIAM3 C(2) NULL SYSTEM', 'PRSPH C(2)', 'PRTOR C(2)'])
And Im trying to add another row to it. What i have tried many different things but i cant seem to append dict to it the way i want. The problem is it does not find ORDNUMB field so for example
table.append( {'ORDNUMB': '633','POSITION': '6', } )
doesn't work, but the
table.append( {'POSITION': '6', } )
does. In first case i get an error that field ORDNUMB cant be found.
Maybe the problem is with the field that is regarded as system ?
Solution 1:[1]
If you are using the dbf
library, then the problem is that the ORDNUMB
field is marked as SYSTEM
-- this means that it is a hidden field and users are not allowed to update it as dbf
will take care of any manipulations. For example, tables that support null values for fields have that information tracked in a _null
SYSTEM
field.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ethan Furman |