Search This Blog

Wednesday, November 21, 2018

How to fix: TypeError: not all arguments converted during string formatting in Python MySQLdb

If you encounter something similar to the following:

Traceback (most recent call last):
  File "scotia.failed.email.py", line 13, in <module>
    cursor.execute (' select * from fail f where f.emailid= (%s) ', (emailid))
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 187, in execute
    query = query % tuple([db.literal(item) for item in args])
TypeError: not all arguments converted during string formatting: