(Migrated) MySQLdb-python module problems

(This message has been automatically imported from the retired mailing list)


I have a script=2C which uses the MySQLdb package and I currently have the =
version 1.2.3 (located at /usr/lib/python2.7/dist-packages/) on my system=
. (current version of zato 2.0.7=2C OS Ubuntu 14.04)

I run the following lines of code:
from MySQLdb import connect as mysql_connect
from MySQLdb import cursors as mysql_cursors

conn =3D mysql_connect(**{
‘host’: ‘localhost’=2C
’port’: 3306=2C
’user’: ‘zato’=2C
’passwd’: ‘zato123’=2C
’db’: ‘test’=2C
’connect_timeout’: 600=2C
’ssl’: None})



When I run the script using python script.py it executes without any prob=
lem. However running the same commands within a service creates an error:

TypeError: cursor() got an unexpected keyword argument 'cursorclass’
Any ideas what might be causing this behaviour? Zato should be able to acce=
ss the module=2C because the first part of the script gets executed. And I =
checked that I have only 1 version of MySQLdb installed on the instance. So=
why would the behaviour be different?

I know that I could use tools from zato to access the mysql instance=2C how=
ever there is a set of tools we already have implemented=2C which have some=
additional features.

Martin Zofka

On 25/04/16 11:06, Andrea Peter wrote:
I have a script, which uses the MySQLdb package and I currently have the version 1.2.3 (located at /usr/lib/python2.7/dist-packages/) on my system. (current version of zato 2.0.7, OS Ubuntu 14.04)
Just a tohught:
Zato includes pymysql which sometimes overrides MySQLdb (see install_as_MySQLdb() here: https://github.com/PyMySQL/PyMySQL/blob/master/pymysql/init.py)
maybe when you import MySQLdb in a service it is in reality pymysql