mxODBC attribute error with MySQL

Peter Hansen peter at engcorp.com
Mon Nov 6 08:52:04 EST 2000


Keith MacDonald wrote:
> 
> I'm trying to use mxODBC 1.1.1 with MySQL and ActivePython 2.  The only
> example I can find to get me started is in the mxODBC documentation, but
> this is what I get when I try it:
> 
> >>> import ODBC.MySQL
> >>> db = ODBC.MySQL.Connect('database','user','passwd')
> AttributeError: Connect
> 
> (same error using "connect" as well)
> 
> This is kind of unhelpful, as it gives me no idea what is wrong.  Can anyone
> help me with this?

See http://www.python.org/doc/current/lib/module-exceptions.html for
help on exceptions, or use your local copy.

AttributeError means that the object contains no attribute with the
specified name.  Therefore it would seem the ODBC.MySQL package does not
contain a method called Connect.

I'm not familiar with the MySQL stuff, but you can often say something
like "dir(ODBC.MySQL)" to get a list of methods which you can use. 
Depending on the implementation, this might or might not work.  It
usually does with pure Python code, but with other packages (e.g. COM
stuff) the methods don't seem to be known in advance...

-- 
Peter Hansen



More information about the Python-list mailing list