python, Mysql_python, storm problem

paul Batoum. paul at itdreamreal.com
Mon Apr 7 22:59:04 EDT 2008


I am actually tryng to build a database apps in python + storm which use
MySQLdb 1.2.2
i actually want the auto reconnect feature of storm, which just need to
change the False param of raw_connect to True in storm/databases/mysql.py so
far nothing really difficult but from there i got quite a weird result:

if i try the following code, it works in the shell python interpreter but
not when i put it in a test.py file and call it as python test.py (will be
helpfull for unittest):

So to make it simple the MySQL reconnect work in the shell interpreter and i
got a DisconnectionError: (2006, 'MySQL server has gone away') when i use it
the other way.

Let me know if one of you have ever experienced something like that

Thx

Code:

import database
import time

# Test timeout cases
pdb = database.Database(connect_info)
res = pdb.execute(u"SHOW VARIABLES LIKE 'wait_timeout'")
# set the timeout to 3 sec
pdb.execute("SET wait_timeout=3")
res = pdb.execute(u"SHOW VARIABLES LIKE 'wait_timeout'")
res = pdb.execute("select * from country")
time.sleep(5)
# try a new execute, this one should pass
res = pdb.execute("select * from country")


-- 
View this message in context: http://www.nabble.com/python%2C-Mysql_python%2C-storm-problem-tp16547127p16547127.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list