add fields in a existing dbf

Alonso Luján Torres Taño lujan at ceam.es
Tue Aug 11 07:26:42 EDT 2009


Hi!

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")


I have not idea of what error I make.

If someone can help me, I'll so gratefull.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090811/c55c76aa/attachment.html>


More information about the Python-list mailing list