Opening .DBF files as read-only using the Python dbf module

First of all, the dbf module is great. I have used it with great success.

I am trying to open a dbf file on a network share, which is a read-only file system. When I try to open it like this, I get an error message stating that the .dbf file is read-only.

thisTable = dbf.Table('/volumes/readOnlyVolume/thisFile.dbf')
thisTable.open()

Looking at the documentation, there seems to be a way to open the table in read-only mode, but I can't figure it out. If you have a second, could you help me?

Thank! Kyle

+4
source share
2 answers

Cool! Thank you!:)

At this point, you need to specify the open mode when you call thisTable.open(), for example:

thisTable.open(mode='read-only')

or

thisTable.open(mode=dbf.READ_ONLY)

, PyPI .

+3

, , :

dbf1 = Dbf()
dbf1.openFile('county.dbf', readOnly=1)

, , , .

0

Source: https://habr.com/ru/post/1542391/


All Articles