[python-win32] MySQLdb AttributeError Problem

Jim Vickroy Jim.Vickroy@noaa.gov
Mon, 16 Jul 2001 08:25:18 -0600


--------------CE331CB0FA7FF8B594568D45
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello John,

I tried to respond to this over the weekend from home, but I never saw
it posted so forgive me if this is a duplicate.

Two or three months ago, I was not able to get MySQLdb to work with
ActivePython, but it did work fine with the "standard" distributions
(1.5.2 and 2.0).

If you have not done so, I would suggest trying Python 2.0 or 2.1 from
http://www.python.org/.

John Hopkins wrote:

> 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 = sys.stdout
> import MySQLdbtry:
>     ThisDB = MySQLdb.Connect(db='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:   File "C:\My
> Documents\Dev Stuff\testdb_list.py", line 8, in ?
>     ThisDB = MySQLdb.connect(db='LabTracker')
> AttributeError: 'MySQLdb' module has no attribute 'Connect' I looked
> through MySQLdb.py and the statement "Connect = connect = 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! Thanks in advance, John Hopkinsjohn@hopkinsit.com

--------------CE331CB0FA7FF8B594568D45
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
Hello John,
<p>I tried to respond to this over the weekend from home, but I never saw
it posted so forgive me if this is a duplicate.
<p>Two or three months ago, I was not able to get MySQLdb to work with
ActivePython, but it did work fine with the "standard" distributions (1.5.2
and 2.0).
<p>If you have not done so, I would suggest trying Python 2.0 or 2.1 from
<A HREF="http://www.python.org/">http://www.python.org/</A>.
<p>John Hopkins wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>I
have an interesting (OK, frustating) problem.&nbsp; I've been developing
on Win98, successfully connecting to a MySQL database via MySQLdb.&nbsp;
I recently installed Win2K Pro on my development machine in dual-boot mode.&nbsp;
I installed ActivePython 2.10.210, MySQLdb 0.3.5 and MySQL 3.23.38 under
Win2K.&nbsp; MySQL works fine, MySQLFront connects, lets me browse tables,
etc. so I know the server is doing its job.</font></font>&nbsp;<font face="Arial"><font size=-1>However,
I haven't been able to connect to the database via MySQLdb.&nbsp; 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:</font></font><font face="Arial"><font size=-1>__________________________________________</font></font><font face="Arial"><font size=-1>import
sys</font></font>
<br><font face="Arial"><font size=-1>import traceback</font></font>
<br><font face="Arial"><font size=-1>sys.stderr = sys.stdout</font></font>
<br><font face="Arial"><font size=-1>import MySQLdb</font></font><font face="Arial"><font size=-1>try:</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp; ThisDB = MySQLdb.Connect(db='LabTracker')</font></font>
<br><font face="Arial"><font size=-1>except:</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
traceback.print_exc()</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sys.exit()</font></font>
<br><font face="Arial"><font size=-1>____________________________________________</font></font>&nbsp;<font face="Arial"><font size=-1>Running
this code (from within PythonWin) worked fine this morning, and I went
on to get a cursor, etc.&nbsp; Now, I get the following traceback:</font></font>&nbsp;<font face="Arial"><font size=-1>&nbsp;
File "C:\My Documents\Dev Stuff\testdb_list.py", line 8, in ?</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp; ThisDB = MySQLdb.connect(db='LabTracker')</font></font>
<br><font face="Arial"><font size=-1>AttributeError: 'MySQLdb' module has
no attribute 'Connect'</font></font>&nbsp;<font face="Arial"><font size=-1>I
looked through MySQLdb.py and the statement "Connect = connect = Connection"
is right where I expected it to be.&nbsp; I've also tried the same code
replacing "Connect" with "Connection" and "connect", to no avail.&nbsp;
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!</font></font>&nbsp;<font face="Arial"><font size=-1>Thanks
in advance,</font></font>&nbsp;<font face="Arial"><font size=-1>John Hopkins</font></font><font face="Arial"><font size=-1><a href="mailto:john@hopkinsit.com">john@hopkinsit.com</a></font></font></blockquote>

</body>
</html>

--------------CE331CB0FA7FF8B594568D45--