pythonpython-3.xdbfxbase

how to update a record with the dbf module


How can I update a record in a dbf with the dbf module : https://pypi.python.org/pypi/dbf

Here is what I tried:

table2 = dbf.Table(filename, codepage="cp1252")
table[0].name = "changed"

But I get:

  File "<input>", line 1, in <module>
  File "/venv/lib/python3.4/site-packages/dbf/ver_33.py", line 2508, in __setattr__
    raise DbfError("unable to modify fields individually except in `with` or `Process()`")
dbf.ver_33.DbfError: unable to modify fields individually except in `with` or `Process()`

I managed to read and append but not to modify data, how can I do that?


Solution

  • Writing data to records can be accomplished in a few different ways:

    I did it this way to enhance both safety and performance.