Python Mysql class to call a stored procedure
<p>I am very new.  All of my experience is on the DB side so I am lost on the Python side of things.  That said I am trying to create a class that I can use to execute stored procedures.  I am using Python 3.4.3.  I found a mysql class on github and simplified/modified it to make a proc call and it is not working.  </p>

<pre><code>mysqlquery.py
import mysql.connector, sys
from collections import OrderedDict

class MysqlPython(object):

    __host       = None
    __user       = None
    __password   = None
    __database   = None
    __procname   = None
    __inputvals  = None



    def __init__(self, host='localhost', user='root', password='', database=''):
        self.__host     = host
        self.__user     = user
        self.__password = password
        self.__database = database
    ## End def __init__

    def __open(self):
            cnx = mysql.connector.connect(self.__host, self.__user, self.__password, self.__database)
            self.__connection = cnx
            self.__session    = cnx.cursor()
    ## End def __open       

    def __close(self):
        self.__session.close()
        self.__connection.close()
    ## End def __close

    def proc(self,procname,inputvals):
        self.__open()
        self.__session.callproc(procname, inputvals)
    ## End for proc

## End class

test.py
from mysqlquery import MysqlPython

connect_mysql = MysqlPython()

result = connect_mysql.proc ('insertlink','1,www.test.com')
</code></pre>

<p>I get this error</p>

<pre><code>TypeError: __init__() takes 1 positional argument but 5 were given
</code></pre>

<p>Looking at my <strong>init</strong>, it take 5 args as it should.  Not sure why I am getting this.  Again, I am very new so it could be a simple problem.</p>

<p>Thanks for any help.</p>

<p>G</p>

<p><code>mysql.connector.connect()</code> takes named arguments, not positional arguments, and you're missing the names.</p>

<pre><code>cnx = mysql.connector.connect(host=self.__host, user=self.__user, password=self.__password, database=self.__database)
</code></pre>

python mysql stored-procedures typeerror