[Tutor] Trying to read dBase files
Al Bull
a.bull at pubdmgroup.com
Tue Mar 11 19:39:59 CET 2014
Greetings.
I'm new to python and want to use it to create an application to read one or
more dbase files, manipulate some data, and create a new file.
I am using Python 3.3. I did some google searches and found something
called dbfpy to read dbase, so I downloaded and installed it.
The examples show.....
>From dbfpy import dbf
When I do this I get the following error:
>>> from dbfpy import dbf
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from dbfpy import dbf
File "C:\Python33\lib\site-packages\dbfpy\dbf.py", line 260
print repr(_rec)
^
SyntaxError: invalid syntax
My assumption is that this module is written for an earlier release of
Python?
Some other google searches suggested using microsofts ODBC drivers for
dBase, so I downloaded and installed pyodbc and got this:
Python 3.3.4 (v3.3.4:7ff62415e426, Feb 10 2014, 18:12:08) [MSC v.1600 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pyodbc
>>> cnxn = pyodbc.connect('DRIVER={Microsoft Access dBASE
Driver};SERVER=localhost;DATABASE={Q:\TWS\MAILMERGE\BIL00008.DBF}')
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
cnxn = pyodbc.connect('DRIVER={Microsoft Access dBASE
Driver};SERVER=localhost;DATABASE=Q:\TWS\MAILMERGE\BIL00008.DBF')
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified (0)
(SQLDriverConnect)')
Do I have the driver name incorrect?
Al Bull
More information about the Tutor
mailing list