Where's the List?

Victor Subervi victorsubervi at gmail.com
Sat Jun 5 16:17:55 EDT 2010


Hi;
I have this:

    for order in order_details:
      store = order[0]
      prodid = order[1]
      pkg = order[2]
      quantity = order[3]
      if 'PatientID' in order_fields:
        patientID = order[4]
        try:
          option_values = order[5:]
        except TypeError:
          option_values = []
        sql = 'insert into orders%s values (Null, %s)' % (store, ",
".join("%s" * (4 + len(option_values))))
        cursor.execute(sql, tuple([pkg, prodid, tmpTable, quantity] +
option_values))
      else:
        patientID =  ''
        try:
          option_values = order[4:]
        except TypeError:
          option_values = []
        sql = 'insert into orders%s values (Null, %s)' % (store, ",
".join("%s" * (4 + len(option_values))))
#        cursor.execute(sql, tuple([pkg, prodid, tmpTable, quantity,
order[4], order[5]]))
        cursor.execute(sql, tuple([pkg, prodid, tmpTable, quantity] +
option_values))

It throws this error:

*TypeError*: can only concatenate list (not "tuple") to list
      args = ('can only concatenate list (not "tuple") to list',)

Where's the list? They're both tuples in that last line of code.
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100605/a72314de/attachment.html>


More information about the Python-list mailing list