TypeError: not all arguments converted during string formatting

Peter Otten __peter__ at web.de
Fri Dec 13 14:33:59 CET 2013


Jai wrote:

> my code :

>             sql = """insert into
>             fashion(GENDER,links,category,item_content,price,seller)
>             VAlUES('%s','%s','%s','%s','%s','s')"""
> cursor.execute(sql,(gender,main_link,cat,item_content,price,seller))

This looks very much like your previous mistake

(1) Don't put quotes around the placeholders. They are probably interpreted 
as string literals.

(2) The last placeholder is missing the %
 
> error:
> 
> 
>     query = query % db.literal(args)
> TypeError: not all arguments converted during string formatting

Note that we prefer to see complete tracebacks as this usually simplifies 
debugging a lot.




More information about the Python-list mailing list