Ok, I use the ancient database format here, dbf files. Don't ask why, just be aware that certain software decided to expand foxpro support because microsoft decided to expand foxpro support. Now I get the following error in a specific file. I have successfully uploaded another file, and I'm curious if there is anything wrong with this database. I'm sure you probably need to look at the database to determine this, but its the path to a huge message, so I will take what I can get.
Traceback (most recent call last): File "billsapi.py", line 250, in <module> x.getUsedGuns() File "billsapi.py", line 72, in getUsedGuns itemdb = dbf.Dbf('item.dbf', readOnly=True, ignoreErrors=True) File "C:\Python27\lib\site-packages\dbfpy\dbf.py", line 135, in __init__ self.header = self.HeaderClass.fromStream(self.stream) File "C:\Python27\lib\site-packages\dbfpy\header.py", line 127, in fromStream _fld = fields.lookupFor(_data[11]).fromString(_data, _pos) File "C:\Python27\lib\site-packages\dbfpy\fields.py", line 455, in lookupFor return _fieldsRegistry[typeCode] KeyError: '0'
And here is my simple code that returns this error:
def getUsedGuns(self): itemdb = dbf.Dbf('item.dbf', readOnly=True, ignoreErrors=True)
As I said, I can upload other files with the problem, but maybe there is work for this particular error?
EDIT: I would also like to indicate that the file can be opened and viewed and modified in DBF View Plus.
EDIT: solution found. I actually used the python dBase module. I think my main problem was that I did not have memo files (no matter what they are, it has the extension .fpt). Here is what I am using at the moment:
from dbf.tables import VfpTable itemdb = VfpTable('item.db') for rec in itemdb: print rec['MY_COLUM_NAME']
I would also like to point out that anyone who currently uses FoxPro needs to be burned.