add fields in a existing dbf
ethan at stoneleaf.us
Tue Aug 11 18:12:44 CEST 2009
Alonso Luján Torres Taño wrote:
> I'm trying to modify a dbf adding a new field in a python script, but I
> Just I can add a field in new dbf created in the same script.
> I tryed with:
> db = dbf.Dbf("../filesource.dbf",new =False, readOnly=False)
> and return error:
> Traceback (most recent call last):
> File "script.py", line 34, in <module>
> File "/usr/lib/python2.5/site-packages/dbfpy/dbf.py", line 229, in
> "structure can't be changed")
> TypeError: ('At least one record was added, ', "structure can't be
> I have not idea of what error I make.
> If someone can help me, I'll so gratefull.
I am not familiar with dbfpy, but the dbf files I am familiar with do
not support 32 digit Numerics. Did you mean 12?
At any rate, if you use http://groups.google.com/group/python-dbase
the commands would be:
db = dbf.Table("../filesource.dbf")
and you'll have your field -- assuming, of course, you have write
Hope this helps!
Disclaimer: I am the author of python-dbase.
More information about the Python-list