I was adding a column to the DBF file and this error appeared, how can I fix it?
import dbf
db = dbf.Table('crop2-fx.dbf')
with db:
db.add_fields('tipoclasse C(10)')
C:\Users\PC\Anaconda2\python.exe" "C:/Users/Secretaria-OBT/Desktop/Estágio Python/23/dbf/addField.py"
Traceback (most recent call last):
File "C:/Users/PC/Desktop/Python/23/dbf/addField.py", line 5, in
db.add_fields('tipoclasse C(10)')
File "C:\Users\PC\Anaconda2\lib\site-packages\dbf\ver_2.py", line 5015, in add_fields
old_table = self.create_backup()
File "C:\Users\PC\Anaconda2\lib\site-packages\dbf\ver_2.py", line 5240, in create_backup
bkup = Table(new_name, self.structure(), codepage=self.codepage.name, dbf_type=self._versionabbr, on_disk=on_disk)
File "C:\Users\PC\Anaconda2\lib\site-packages\dbf\ver_2.py", line 4784, in __init__
self.add_fields(field_specs)
File "C:\Users\PC\Anaconda2\lib\site-packages\dbf\ver_2.py", line 5059, in add_fields
raise FieldSpecError(exc.message + ' (%s:%s)' % (meta.filename, name))
dbf.ver_2.FieldSpecError: Numeric fields must be between 1 and 19 digits, not 24 (C:\Users\SECRET~1\AppData\Local\Temp\crop2-fx_backup.dbf:ampl_b0)
Process finished with exit code 1
The problem is one of the existing numeric fields is larger than
dbfcurrenntly handles (19 digits is the max). I'm pretty sure the only way past this at the moment is to reduce the numeric field before usingdbfwith it.