My Darned Image Again

Victor Subervi victorsubervi at gmail.com
Tue Dec 8 14:41:02 EST 2009


On Tue, Dec 8, 2009 at 3:28 PM, MRAB <python at mrabarnett.plus.com> wrote:

> Victor Subervi wrote:
>
>> Hi;
>> I'm having trouble loading my image again. Here's my code:
>>
>>      for pic in pics:
>>        sql = 'update %s set %s=%s where SKU=%s;' % (store,
>> colNamesPics[i], '%s', sku)
>>
>
> After this, 'sql' will be a string.
>
>
>         sql = sql, (MySQLdb.Binary(pics[int(i)]),)
>>
>
> After this, 'sql' will be a tuple.
>
>
>         cursor.execute(sql, (MySQLdb.Binary(pics[int(i)]),))
>>
> [snip]
>
> You're passing 'sql', which is a tuple, as the query. What was the
> purpose of the previous line?
>

To print stuff out to screen. I don't know what happened, but when I pulled
that out, it threw a familiar error that alerted me to quote the last
variable (SKU="%s") and the blob went straight in. Thanks!
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091208/003f83ff/attachment.html>


More information about the Python-list mailing list