Reputation: 103
First of all, the dbf module is great. I've been using it with great success.
I'm 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 which says that the .dbf file is read-only.
thisTable = dbf.Table('/volumes/readOnlyVolume/thisFile.dbf')
thisTable.open()
Looking at the documentation, it looks like there's a way to open a table in read-only mode, but I can't figure it out. If you have a second, would you be able to help me out?
Thanks! Kyle
Upvotes: 5
Views: 1942
Reputation: 69288
Cool, thanks! :)
At this point, you need to specify the open mode when you call thisTable.open()
, like this:
thisTable.open(mode='read-only')
or
thisTable.open(mode=dbf.READ_ONLY)
Oh, and here's the PyPI link to the module.
Upvotes: 5
Reputation: 34677
Assuming you're using this module, the magic incantation to open read only is:
dbf1 = Dbf()
dbf1.openFile('county.dbf', readOnly=1)
Hope that helped, if not, do add more detail to your question.
Upvotes: 0