From: Katie C. <kat...@gm...> - 2010-10-22 20:27:54
|
Hi there. I'm trying to read some bdf files using dbfpy. The code I'm using is here: *************************************************************** #!/usr/local/bin/python import os, sys import dbfpy from dbfpy import dbf infiles = ['SWATOutput_Current_2ndtime.mdb','SWATOutput_Future_2ndTime.mdb'] for file in infiles: print file db = dbf.Dbf(file) #db.openFile(file,readOnly=1) names = [] print "%s contents: " % (file) for field in db.header.fileds: names.append(field.name) print field for rec in db: print '%s:' % (rec) print rec.fieldData db.close() ************************************************* gives this error: ./process_SWAT_output.py SWATOutput_Current_2ndtime.mdb Traceback (most recent call last): File "./process_SWAT_output.py", line 13, in <module> db = dbf.Dbf(file) File "/usr/local/lib/python2.5/site-packages/dbfpy/dbf.py", line 135, in __init__ self.header = self.HeaderClass.fromStream(self.stream) File "/usr/local/lib/python2.5/site-packages/dbfpy/header.py", line 120, in fromStream (_year, ord(_data[2]), ord(_data[3]))) File "/usr/local/lib/python2.5/site-packages/dbfpy/header.py", line 89, in __init__ self.lastUpdate = getDate(lastUpdate) File "/usr/local/lib/python2.5/site-packages/dbfpy/utils.py", line 75, in getDate return datetime.date(*date[:3]) ValueError: month must be in 1..12 Any ideas on what is causing this error? Thanks! katie |