[python-win32] MySQLdb AttributeError Problem

John Hopkins john_hopkins@bigfoot.com
Sat, 14 Jul 2001 22:28:41 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0057_01C10CB4.55863570
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have an interesting (OK, frustating) problem.  I've been developing on =
Win98, successfully connecting to a MySQL database via MySQLdb.  I =
recently installed Win2K Pro on my development machine in dual-boot =
mode.  I installed ActivePython 2.10.210, MySQLdb 0.3.5 and MySQL =
3.23.38 under Win2K.  MySQL works fine, MySQLFront connects, lets me =
browse tables, etc. so I know the server is doing its job.

However, I haven't been able to connect to the database via MySQLdb.  I =
have a little Python script I originally used to learn how to handle the =
data returned by a cursor within Python, called "testdb_list.py" Here's =
a code snippet:
__________________________________________
import sys
import traceback
sys.stderr =3D sys.stdout
import MySQLdb

try:
    ThisDB =3D MySQLdb.Connect(db=3D'LabTracker')
except:
        traceback.print_exc()
        sys.exit()
____________________________________________

Running this code (from within PythonWin) worked fine this morning, and =
I went on to get a cursor, etc.  Now, I get the following traceback:
=20
  File "C:\My Documents\Dev Stuff\testdb_list.py", line 8, in ?
    ThisDB =3D MySQLdb.connect(db=3D'LabTracker')
AttributeError: 'MySQLdb' module has no attribute 'Connect'
=20
I looked through MySQLdb.py and the statement "Connect =3D connect =3D =
Connection" is right where I expected it to be.  I've also tried the =
same code replacing "Connect" with "Connection" and "connect", to no =
avail.  I'm trying to finish up a project which will involve =
installation on WinNT 4.0 (which is why I'm fiddling with Win2K; it's =
the closet thing I have to the NT 4 environment), so any help will be =
tremendously appreciated!
=20
Thanks in advance,
=20
John Hopkins
john@hopkinsit.com

------=_NextPart_000_0057_01C10CB4.55863570
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>I have an interesting (OK, frustating)=20
problem.&nbsp; I've been&nbsp;developing on Win98, successfully =
connecting to a=20
MySQL database via MySQLdb.&nbsp; I recently installed Win2K Pro on my=20
development machine in dual-boot mode.&nbsp; I installed ActivePython=20
2.10.210,&nbsp;MySQLdb 0.3.5 and MySQL 3.23.38 under Win2K.&nbsp; MySQL =
works=20
fine, MySQLFront connects, lets me browse tables, etc. so I know the =
server is=20
doing its job.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However, I haven't been able to connect =
to the=20
database via MySQLdb.&nbsp; I have a little Python script I originally =
used to=20
learn how to handle the data returned by a cursor within Python, called=20
"testdb_list.py" Here's a code snippet:</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>__________________________________________</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>import sys<BR>import =
traceback<BR>sys.stderr =3D=20
sys.stdout<BR>import MySQLdb<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>try:<BR>&nbsp;&nbsp;&nbsp; ThisDB =3D=20
MySQLdb.Connect(db=3D'LabTracker')<BR>except:<BR>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
traceback.print_exc()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
sys.exit()<BR>____________________________________________</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Running this code (from within =
PythonWin) worked=20
fine this morning, and I went on to get a cursor, etc.&nbsp; Now, I get =
the=20
following traceback:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; File "C:\My Documents\Dev=20
Stuff\testdb_list.py", line 8, in ?<BR>&nbsp;&nbsp;&nbsp; ThisDB =3D=20
MySQLdb.connect(db=3D'LabTracker')<BR>AttributeError: 'MySQLdb' module =
has no=20
attribute 'Connect'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I looked through MySQLdb.py and the =
statement=20
"Connect =3D connect =3D Connection" is right where I expected it to =
be.&nbsp; I've=20
also tried the same code replacing "Connect" with "Connection" and =
"connect", to=20
no avail.&nbsp; I'm trying to finish up a project which will involve=20
installation on WinNT 4.0 (which is why I'm fiddling with Win2K; it's =
the closet=20
thing I have to the NT 4 environment), so any help will be tremendously=20
appreciated!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>John Hopkins</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"mailto:john@hopkinsit.com">john@hopkinsit.com</A></DIV></FONT></F=
ONT></DIV></BODY></HTML>

------=_NextPart_000_0057_01C10CB4.55863570--