You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am adding records to an existing dbf, the recs are correctly inserted, but the header field record_count is not incremented with the added records which leads to corrupt db file.
Apparently problem is here:
def flush(self, stream):
if not self.changed:
return
self.last_update = datetime.date.today()
self.write(stream)
you are indeed incrementing the record_count but you are not telling the header that a record was added. Adding this update into db.write() method fixes the issue:
if record.index is None:
# we must increase record count before set index,
# because set index will raise error if out of range
self.header.record_count += 1
record.index = self.header.record_count - 1
self.header._changed = True # <= added line to force header recalc
The text was updated successfully, but these errors were encountered:
Hello,
I am adding records to an existing dbf, the recs are correctly inserted, but the header field record_count is not incremented with the added records which leads to corrupt db file.
Apparently problem is here:
you are indeed incrementing the record_count but you are not telling the header that a record was added. Adding this update into db.write() method fixes the issue:
The text was updated successfully, but these errors were encountered: