Victor Subervi wrote:
I still have this code:

sql = 'select * from options%s where ID=%%s', (opTable[0].upper() + opTable[1:])
      cursor.execute(sql, (id,))

which throws this error:

/var/www/html/angrynates.com/cart/enterOptionsPrices2.py <http://angrynates.com/cart/enterOptionsPrices2.py>
   70     print 'All options prices have been successfully updated.'
   71     print '</body>\n</html>'
   72
   73 enterOptionsPrices2()
   74
enterOptionsPrices2 = <function enterOptionsPrices2>
/var/www/html/angrynates.com/cart/enterOptionsPrices2.py <http://angrynates.com/cart/enterOptionsPrices2.py> in enterOptionsPrices2()
   58       id = form.getfirst('%sID' % option)
59 sql = 'select * from options%s where ID=%%s', (opTable[0].upper() + opTable[1:])
   60       cursor.execute(sql, (id,))
61 # cursor.execute('select * from options%s where ID=%s' % (opTable[0].upper() + opTable[1:], id))
   62       if cursor.fetchone() is not None:
cursor = <MySQLdb.cursors.Cursor object>, cursor.execute = <bound method Cursor.execute of <MySQLdb.cursors.Cursor object>>, sql = ('select * from options%s where ID=%%s', 'Sizes'), id = '0.00' /usr/lib64/python2.4/site-packages/MySQLdb/cursors.py in execute(self=<MySQLdb.cursors.Cursor object>, query=('select * from options%s where ID=%%s', 'Sizes'), args=('0.00',))
  144         db = self._get_db()
  145         charset = db.character_set_name()
  146         query = query.encode(charset)
  147         if args is not None:
  148             query = query % db.literal(args)
query = ('select * from options%s where ID=%%s', 'Sizes'), query.encode undefined, charset = 'latin1'

AttributeError: 'tuple' object has no attribute 'encode'
      args = ("'tuple' object has no attribute 'encode'",)


Please advise.

On line 59 you're making a tuple.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to