mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python 'tuple' cannot be converted to a MySQL type
<p>I'm new to Python, I just couldn't find enough examples of this pattern.  Running Python 3.4, with the MySQL Python Connector installed.   MySQL Version 5.7.</p>

<p>With this set of code (I've replaced the values for user, password etc with blanks):</p>

<pre><code>import mysql.connector
cnx = mysql.connector.connect(user='', 
                        password='   ',
                        host='    ',
                        database='     ')
cursor = cnx.cursor()  
PortExistsQ = "SELECT Count(*) FROM portfolio WHERE idPortfolio=%s AND YearWeek(Signal_Date)=%s AND Rank=1"
cursor.execute(PortExistsQ,(portID,Yearweek))
</code></pre>

<p>I get this error.  </p>

<pre><code>Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\conversion.py", line 179, in to_mysql
    return getattr(self, "_{0}_to_mysql".format(type_name))(value)
AttributeError: 'MySQLConverter' object has no attribute '_tuple_to_mysql'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 417, in _process_params
    res = [to_mysql(i) for i in res]
  File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 417, in &lt;listcomp&gt;
    res = [to_mysql(i) for i in res]
  File "C:\Python34\lib\site-packages\mysql\connector\conversion.py", line 182, in to_mysql
    "MySQL type".format(type_name))
TypeError: Python 'tuple' cannot be converted to a MySQL type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
    self.run()
  File "C:\Python34\lib\threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "C:\workspace\DIY Investing\CSI\CalcP.py", line 56, in calcport
    cursor.execute(PortExistsQ,(portID,Yearweek))
  File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 539, in execute
    psub = _ParamSubstitutor(self._process_params(params))
  File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 422, in _process_params
    "Failed processing format-parameters; %s" % err)
mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python 'tuple' cannot be converted to a MySQL type
</code></pre>

<p>THe SQL runs as expected in MySQL Workbench.  With values for Portfolio of 2 and YearWeek of 201644, (the first value used that caused the error), the result in MySQL is Count(*) of 1.</p>

<p>A code snippet of </p>

<pre><code>print ("Portfolio", portID, "YearWeek", Yearweek)
</code></pre>

<p>Produces the following output</p>

<pre><code>Portfolio 2 YearWeek (201644,)
</code></pre>

<p>Any suggestions?</p>