csv format to DBase III format

Peter Otten __peter__ at web.de
Sat Jan 7 04:10:10 EST 2006

William wrote:

> Peter Otten wrote:
>> coriolis_wong at yahoo.com.hk wrote:
>> > I need to transfer csv format file to DBase III format file.
>> > How do i do it in Python language?
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715

> I create a dbf file, it can be opened by Excel but it cannot be opened
> by Access. Where is the error in my script. 

No idea, but here's some brainstorming.

>     f = open('test.dbf','w')

First make sure that you open the file in binary mode 'wb'.
If you have an application around that can generate dbfs you could compare a
manually created file with the python-generated one. Have you tried the dbf
with no records? If that is opened without error, you could successively
add records until you find the culprit. Finally, if Excel and Access
disagree about the dbf's validity, the Access import filter could be
broken. Are there other filters for the Dbase family (Foxpro, Clipper)? Try
one of them.


More information about the Python-list mailing list