Reading Dbase files

Robert Amesz sheershion at mailexpire.com
Sun May 12 18:40:03 EDT 2002


Leo Noordhuizen wrote:

> I am trying to read .dbf files using the (old) dbf.py module
> (version 0.2 1999/11/12 written
> by Michal Spalinski. This seemed to work quite well, untill I
> found out that records which apparantly
> have been deleted are also read as 'normal'...
> In other words: not really useable or at least not compatible with
> this format of .dbf files.
> 
> I am looking for advise how to proceed. I really need this
> functionality and should like to keep on using Python.

I'm not familiar with dbf.py, but old dBase programs don't physically 
delete the record (not right away, anyway) but set a marker in a 
special field to indicate their deleted status. I presume there's some 
way in which this marker can be tested in dbf.py, and if not it 
shouldn't be terribly hard to add this. The dBase file format is well 
documented over the years.

Alternatives: 
- under Windows you can use ODBC datasource manager in the control 
panel to setup a dBase datasource, after which you can use ODBC to get 
at your data.

- Wrap a dBase library like Xbase for use under Python.



Robert Amesz



More information about the Python-list mailing list