Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'string.': 0.05; 'attribute': 0.07; 'string': 0.09; 'correct,': 0.09; '"%s"': 0.16; "'%s'": 0.16; 'expecting': 0.16; 'fails.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'invocation': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'example': 0.22; 'header:User-Agent:1': 0.23; 'this:': 0.26; 'pass': 0.26; 'header :In-Reply-To:1': 0.27; 'record': 0.27; 'host': 0.29; "doesn't": 0.30; 'maybe': 0.34; 'could': 0.34; "can't": 0.35; 'problem.': 0.35; 'received:84': 0.35; 'but': 0.35; 'should': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'solve': 0.60; 'kind': 0.63; 'within': 0.65; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; '8bit%:100': 0.72; 'subject:get': 0.81; '05,': 0.84; 'fails,': 0.84; 'reply- to:addr:python.org': 0.84; 'visitor': 0.84; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=PIY2p5aC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=LqG8EI-UCiYA:10 a=YqGxIhlWyP0A:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=qAJBx_z0r4oA:10 a=haMhEv007vtwP0lATjEA:9 a=QEXdDO2ut3YA:10 a=gABgzW2dCvkA:10 X-AUTH: mrabarnett:2500 Date: Sat, 05 Oct 2013 17:51:27 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Select fails when cookie tried to get a numeric value References: <20131005144418.GA2743@piedra> In-Reply-To: <20131005144418.GA2743@piedra> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380991878 news.xs4all.nl 16009 [2001:888:2000:d::a6]:33658 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56208 On 05/10/2013 15:44, Zero Piraeus wrote: > On Sat, Oct 05, 2013 at 05:30:53PM +0300, Νίκος Αλεξόπουλος wrote: >> Every mysql statemtns that involved cookieID fails. >> >> in this example this: >> >> # find the visitor record for the (saved) cID and current host >> cur.execute('''SELECT * FROM visitors WHERE counterID = %s and >> cookieID = %s''', (cID, cookieID) ) >> data = cur.fetchone() #cookieID is unique > > If every cur.execute() invocation that you try to pass cookieID to > fails, that suggests you can't pass cookieID to cur.execute() ... > perhaps because it's the wrong type. > > The use of '%s' string interpolation suggests that cur.execute() is > expecting a string. Is cookieID a string? If not, is it some kind of > object that contains a string value within it? Maybe it has some kind > of attribute you could pass, like cookieID.value or similar? > MySQL string interpolation uses "%s" as the placeholder, but the value doesn't have to be a string. > That may or may not be correct, but it's the kind of mental process > you should be going through to solve your problem. >