Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61823

Re: TypeError: not all arguments converted during string formatting

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'debugging': 0.07; 'error:': 0.07; 'string': 0.09; 'arguments': 0.09; 'converted': 0.09; 'formatting': 0.09; 'interpreted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'literals.': 0.16; 'placeholder': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'simplifies': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'query': 0.26; 'skip:v 30': 0.26; 'header:X-Complaints-To:1': 0.27; 'code': 0.31; 'usually': 0.31; 'lot.': 0.31; 'quotes': 0.31; 'probably': 0.32; 'subject:all': 0.32; '(2)': 0.35; 'to:addr:python-list': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'complete': 0.62; 'skip:f 50': 0.65; 'mistake': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: TypeError: not all arguments converted during string formatting
Date Fri, 13 Dec 2013 14:33:59 +0100
Organization None
References <01721890-9bbb-4c90-9668-11a73ef5ea8a@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p50848b94.dip0.t-ipconnect.de
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4070.1386941628.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386941628 news.xs4all.nl 2859 [2001:888:2000:d::a6]:54338
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61823

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

TypeError: not all arguments converted during string formatting Jai <jaiprakashsingh213@gmail.com> - 2013-12-13 05:18 -0800
  Re: TypeError: not all arguments converted during string formatting Ervin Hegedüs <airween@gmail.com> - 2013-12-13 14:26 +0100
  Re: TypeError: not all arguments converted during string formatting Peter Otten <__peter__@web.de> - 2013-12-13 14:33 +0100

csiph-web