简体   繁体   English

添加字段dbf文件错误

[英]add field dbf file error

I was adding a column to the DBF file and this error appeared, how can I fix it? 我正在向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

The problem is one of the existing numeric fields is larger than dbf currenntly handles (19 digits is the max). 问题是现有数字字段之一大于dbf当前处理的最大值(最大19位)。 I'm pretty sure the only way past this at the moment is to reduce the numeric field before using dbf with it. 我敢肯定,目前唯一的解决方法是在使用dbf之前减少数字字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM