我在DBF文件中添加了一个列,出现了这个错误,我该如何解决?
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
答案 0 :(得分:0)
问题是现有数字字段之一大于dbf
当前处理(最多19位数)。我很确定目前唯一的方法就是在使用dbf
之前减少数字字段。