Here's the code I'm using, which I believe it set up correctly
following the docs, but I'm hitting the following errors:

Error 1:

Exception exceptions.TypeError: "'NoneType' object is not callable" in
<bound method PooledDB.__del__ of <DBUtils.PooledDB.PooledDB instance
at 0x85095cc>> ignored

Error 2:

[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1] Traceback (most
recent call last):
...
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/utilitymill/utility.py", line 14, in <module>
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]     import MySQL_EZ

Note: line 60 is the POOL =... line in the code below.

[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/utilitymill/MySQL_EZ.py", line 60, in <module>
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
passwd=PASSWORD,db=DATABASE,user=USERNAME,host=HOSTNAME)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/PooledDB.py",
line 219, in __init__
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
[self.connection(0) for i in range(mincached)]
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/PooledDB.py",
line 267, in connection
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]     con =
self.steady_connection()
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/PooledDB.py",
line 224, in steady_connection
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
self._maxusage, self._setsession, *self._args, **self._kwargs)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/SteadyDB.py",
line 111, in connect
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]     return
SteadyDBConnection(creator, maxusage, setsession, *args, **kwargs)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/SteadyDB.py",
line 138, in __init__
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
self._store(self._create())
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/DBUtils-0.9.4-py2.5.egg/DBUtils/SteadyDB.py",
line 142, in _create
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]     con =
self._creator(*self._args, **self._kwargs)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/MySQLdb/__init__.py", line 75, in
Connect
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]     return
Connection(*args, **kwargs)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]   File
"/usr/lib/python2.5/site-packages/MySQLdb/connections.py", line 164,
in __init__
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
super(Connection, self).__init__(*args, **kwargs2)
[Tue Nov 20 17:07:23 2007] [error] [client 127.0.0.1]
OperationalError: (1040, 'Too many connections')

I set my.conf to have 16 max connections so I don't know why it says
there are too many since I only gave the pool 10.

Thanks in advance for any help.

Greg


The code:

#! /usr/bin/env python2.5

import sys
import MySQLdb #<-Definately need this
(http://sourceforge.net/projects/mysql-python)
from DBUtils.PooledDB import PooledDB #http://www.webwareforpython.org/DBUtils

#-----------------------------------------------------------------------------
#Connection Info
HOSTNAME='127.0.0.1'
USERNAME='user'
PASSWORD='password'
DATABASE='pets'
#-----------------------------------------------------------------------------

POOL = PooledDB(creator=MySQLdb,mincached=4,maxcached=10,maxshared=0,
    maxconnections=10,blocking=False,maxusage=100,setsession=['SET
AUTOCOMMIT = 1'],
    passwd=PASSWORD,db=DATABASE,user=USERNAME,host=HOSTNAME)

def query(SQL_stmt,values=None):
    db=POOL.connection(0);cur=db.cursor()
    if values:
        cur.execute(SQL_stmt,values)
    else:
        cur.execute(SQL_stmt)
    result=cur.fetchall()
    cur.close(); db.close()
    return result

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to