<p>I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python?  I only need to read them, and would preferably have access to the memo fields too.</p>

<p><strong>Update</strong>: Thanks @cnu, I used Yusdi Santoso's <a href="http://www.physics.ox.ac.uk/users/santoso/dbf.py.src" rel="noreferrer"><code>dbf.py</code></a> and it works nicely.  One gotcha: The memo file name extension must be lower case, i.e. <code>.fpt</code>, not <code>.FPT</code> which was how the filename came over from Windows.</p>

[{'answer_id': 37553, 'author': 'cnu', 'author_id': 1448, 'author_profile': 'https://Stackoverflow.com/users/1448', 'pm_score': 4, 'selected': True, 'text': '<p>You can try this <a href="http://code.activestate.com/recipes/362715/" rel="nofollow noreferrer">recipe on Active State</a>. </p>\n\n<p>There is also a <a href="http://code.google.com/p/lino/source/browse/lino/utils/dbfreader.py" rel="nofollow noreferrer">DBFReader module</a> which you can try.</p>\n\n<p>For support for <a href="http://www.physics.ox.ac.uk/users/santoso/dbf.py.src" rel="nofollow noreferrer">memo fields</a>.</p>\n'}, {'answer_id': 37917, 'author': 'Anders Sandvig', 'author_id': 1709, 'author_profile': 'https://Stackoverflow.com/users/1709', 'pm_score': 4, 'selected': False, 'text': '<p>I prefer <a href="http://sourceforge.net/projects/dbfpy/" rel="noreferrer">dbfpy</a>. It supports both reading and writing of <code>.DBF</code> files and can cope with most variations of the format. It\'s the only implementation I have found that could both read and write the legacy DBF files of some older systems I have worked with.</p>\n'}, {'answer_id': 86420, 'author': 'Kirk Strauser', 'author_id': 32538, 'author_profile': 'https://Stackoverflow.com/users/32538', 'pm_score': 3, 'selected': False, 'text': '<p>If you\'re still checking this,  I have a GPL FoxPro-to-PostgreSQL converter at <a href="https://github.com/kstrauser/pgdbf" rel="noreferrer">https://github.com/kstrauser/pgdbf</a> .  We use it to routinely copy our tables into PostgreSQL for fast reporting.</p>\n'}, {'answer_id': 578444, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>Check out <a href="http://groups.google.com/group/python-dbase" rel="noreferrer">http://groups.google.com/group/python-dbase</a></p>\n\n<p>It currently supports dBase III and Visual Foxpro 6.0 db files... not sure if the file layout change in VFP 9 or not...</p>\n'}, {'answer_id': 10254842, 'author': 'Steve Koch', 'author_id': 868718, 'author_profile': 'https://Stackoverflow.com/users/868718', 'pm_score': 4, 'selected': False, 'text': '<p>I was able to read a DBF file (with associated BAK, CDX, FBT, TBK files**) using the dbf package from PyPI <a href="http://pypi.python.org/pypi/dbf">http://pypi.python.org/pypi/dbf</a> . I am new to python and know nothing about DBF files, but it worked easily to read a DBF file from my girlfriend\'s business (created with a music store POS application called AIMsi).  </p>\n\n<p>After installing the dbf package (I used aptitude and installed dbf version 0.88 I think), the following python code worked:</p>\n\n<pre><code>from dbf import *\ntest = Table("testfile.dbf")\nfor record in test:\n    print record\n    x = raw_input("")  # to pause between showing records\n</code></pre>\n\n<p>That\'s all I know for now, but hopefully it\'s a useful start for someone else who finds this question!</p>\n\n<blockquote>\n  <p>April 21, 2012 SJK Edit: Per Ethan Furman\'s comment, I should point out that I actually don\'t know <em>which</em> of the data files were necessary, besides the DBF file.  The first time I ran the script, with only the DBF available, it complained of a missing support file.  So, I just copied over the BAK, CDX, FPT (not FBT as I said before edit), TBK files and then it worked. </p>\n</blockquote>\n'}, {'answer_id': 38730628, 'author': 'Shawn', 'author_id': 6615512, 'author_profile': 'https://Stackoverflow.com/users/6615512', 'pm_score': 3, 'selected': False, 'text': "<p>It's 2016 now and I had to fiddle with the dbf package to get it to work. Here is a python3 version to just export a dbf file to a csv</p>\n\n<pre><code>import dbf\n\nd=dbf.Table('mydbf.dbf')\nd.open()\ndbf.export(d, filename='mydf_exported.csv', format='csv', header=True)\n</code></pre>\n\n<p>I had some unicode error at first, but got around that by turning off memos.</p>\n\n<pre><code>import dbf\n\nd=dbf.Table('mydbf.dbf', ignore_memos=True)\nd.open()\ndbf.export(d, filename='mydf_exported.csv', format='csv', header=True)\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/37535', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3715/']