adodbapi help needed

Ian Hobson ian at ianhobson.co.uk
Tue Aug 24 11:25:30 EDT 2010


Hi all,

I am just starting to learn Python and I have a setup problem - I think. 
Python 3.1.

I have a small test script that is not working as expected.

Start script-----------
# coding=utf8
import adodbapi
connectString = (
     "DRIVER={MySQL ODBC 5.1 Driver} ;"
     "SERVER=127.0.0.1;"
     "PORT=3306;"
     "DATABASE=moschatel;"
     "USER=Moschatel;"
     "PASSWORD=badger43time;"
     "OPTION=3;"
)
# MySQL ODBC 5.1 Driver - version 5.01.06.00 is installed
db = adodbapi.connect(connectString)
------------end script --------------

I get an error message that reads
D:\websites\moschatel\sop\Printing>test.py
Traceback (most recent call last):
   File "D:\websites\moschatel\sop\Printing\test.py", line 13, in <module>
     db = adodbapi.connect(connectString)
AttributeError: 'module' object has no attribute 'connect'

Now, adodbapi is installed into
D:\websites\moschatel\sop\Printing\adodbapi

and contains file adodbapi.py, and line 279 reads

def connect(connection_string, timeout=30):

I expected that to be called.

What have I missed?

Regards

Ian





More information about the Python-list mailing list