Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

dbf

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

like image 713
Kyle Swanson Avatar asked May 28 '14 21:05

Kyle Swanson


1 Answers

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.

like image 108
Ethan Furman Avatar answered Oct 11 '22 11:10

Ethan Furman