Alonso Luján Torres Taño wrote, at 11.08.2009 13:55:
>
> I'm trying to modify a dbf adding a new field in a python script, but I
> can't.
>
> 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)
> ...
> db.addField(("PESO","N",32,8))
>
> and return error:
>
> Traceback (most recent call last):
> File "script.py", line 34, in <module>
> db.addField(("PESO","N",32,8))
> File "/usr/lib/python2.5/site-packages/dbfpy/dbf.py", line 229, in addField
> "structure can't be changed")
> TypeError: ('At least one record was added, ', "structure can't be changed")
you should create new dbf with desired structure and copy data.
best wishes,
alex.
|