我试图将记录添加到具有索引文件和备忘录文件的现有空DBF表(Fox Pro)。它已经存在我的文件夹中:Python DBF。使用fpt备忘录字段将记录添加到dbf表中
Table.dbf
Table.fpt
Table.cdx
Table.dbf有三个字段:
Field1 (Integer)
Field2 (Character)
Field3 (Memo)
我用一种方法,在
http://stackoverflow.com/questions/37891686/how-to-add-a-field-to-a-dbf-file
形容如下:
import dbf
db = dbf.Table('table.dbf')
db.open()
rec = dbf.create_template(db)
rec.field1 = 9
rec.field2 = ('some text')
db.append(rec)
到目前为止这么好。问题是,当一个字段类型备忘录的
Db = dbf.Table ('table.dbf')
Db.open()
Rec = dbf.create_template (db)
Rec.field1 = 9
Rec.field2 = ('some text')
Rec.field3 = ('This is a long text')
Db.append (rec)
然后,我有一个错误信息:
Traceback (most recent call last):
File "dbf12.py", line 8, in <module>
Rec.field3= ('This is a long text')
File "...libsite-packages\dbf\ver_33.py", line 2959, in __setattr__
Self._dirty = True
File "...libsite-packages\dbf\ver_33.py", line 2956, in __setattr__
Raise FieldMissingError (name)
Dbf.ver_33.FieldMissingError: '_dirty: no such field in table'
我在
Http://stackoverflow.com/questions/16682470/using-python-to-write-dbf-table-with-fpt-memos?rq=1
我想看着一个类似的问题改变:
Db = dbf.Table ('table.dbf', dbf_type = 'Vfp')
但结果是一样的。
有谁知道进入备忘录字段的正确方法吗?
谢谢。
寻找到它。 –
您使用的是最新版本吗? 0.96.8。如果没有,请升级并重试。让我们知道你是否仍然有问题。 –
这是一个conda安装。列表为dbf 0.96.003,py36_0。 Thaks Ethan。 –