From: Peter Otten on
Victor Subervi wrote:

> Where's the list? They're both tuples in that last line of code.

> 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 = []

Here...

> 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 = []

there...

> 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',)

everywhere?

From: Emile van Sebille on
On 6/5/2010 1:17 PM Victor Subervi said...
> 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.

No they're not. That's what the error is saying.