2014-11-06 55 views
0

我有一個小腳本,將dbf文件轉換成mysql並將它們上傳到數據庫。它在一臺機器上工作正常,但不是另一臺機器。我得到一個NotImplementedError。具有問題python dbf reader:NotImplementedError

代碼片段IM:

from dbf import dbf 

db = dbf.Dbf("test.dbf") 
for i in db: 
    print i["One"] 
    print i["Two"] 

回溯:

Traceback (most recent call last): 
    File "test.py", line 4, in <module> 
    for i in db: 
    File "C:\Users\Admin1\Desktop\python\virtual\dbfpy\dbf.py", line 242, in __get 
item__ 
    return self.RecordClass.fromStream(self, self._fixIndex(index)) 
    File "C:\Users\Admin1\Desktop\python\virtual\dbfpy\record.py", line 121, in fr 
omStream 
    return cls.fromString(dbf, cls.rawFromStream(dbf, index), index) 
    File "C:\Users\Admin1\Desktop\python\virtual\dbfpy\record.py", line 140, in fr 
omString 
    [_fd.decodeFromRecord(string) for _fd in dbf.header.fields]) 
    File "C:\Users\Admin1\Desktop\python\virtual\dbfpy\fields.py", line 173, in de 
codeFromRecord 
    return self.decodeValue(self.rawFromRecord(record)) 
    File "C:\Users\Admin1\Desktop\python\virtual\dbfpy\fields.py", line 342, in de 
codeValue 
    raise NotImplementedError 
NotImplementedError 
+0

他們是否運行不同版本的dbf庫? – 2014-11-06 10:58:45

回答

-1

我曾經有過一個類似的問題與項目我工作。

事實證明,這是因爲我在表中添加了一個備忘錄字段中設置了錯誤的類型。

一旦我糾正了字段類型,一切正常,下面的堆棧溢出後幫助我。

Python dbfpy and FoxPro