Can't read DBF file (dbf library)

Viewed 363

I'm trying to read DBF files from a mailing software called BCC Mail Manager.

I'm not able to read the DBF file into a table:

import from dbf import *
filename = r"MailList.DBF"

db = Table(filename)

Output:

Traceback (most recent call last):
  File "sandbox.py", line 6, in <module>
    db = Table(filename)
  File "/mnt/c/Users/Kevin/Desktop/bash/.local/lib/python3.6/site-packages/dbf/__init__.p
y", line 5672, in __new__
    possibles = guess_table_type(filename)
  File "/mnt/c/Users/Kevin/Desktop/bash/.local/lib/python3.6/site-packages/dbf/__init__.p
y", line 8932, in guess_table_type
    reported = table_type(filename)
  File "/mnt/c/Users/Kevin/Desktop/bash/.local/lib/python3.6/site-packages/dbf/__init__.p
y", line 8975, in table_type
    raise DbfError("Unknown dbf type: %s (%x)" % (version, version))
dbf.DbfError: Unknown dbf type: 140 (8c)
2 Answers

Fun fact: Ethan was a coworker of mine when he was developing the python dbf package.

I still use BCC. Lists imported into Mail Manager can only be dBase 5 or 7. You can export from the File menu as an earlier version of dbf.

File > Export List

Change the drop down to dBase/FoxPro

Click dBase Options and choose one of the options that is not dBase 5 or 7.

Fun fact: Working with BCC was why I originally wrote dbf.

As I recall, you can change the BCC settings to specify which format of dbf file you want to write (at least, 10 years ago you could). Try switching to db3 or vfp6.

Related