Path: csiph.com!usenet.pasdenom.info!news.izac.org!ohm.izac.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'read.': 0.03; 'error:': 0.07; 'initialize': 0.07; 'cookie': 0.09; 'exist,': 0.09; 'host,': 0.09; 'posting.': 0.09; 'prefix': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'suggest': 0.14; 'wrote': 0.14; '%s,': 0.16; "'/'": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'logging': 0.26; 'skip:" 40': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'record': 0.27; 'am,': 0.29; 'gives': 0.31; 'code': 0.31; 'once,': 0.31; 'file': 0.32; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'easy': 0.60; 'removing': 0.60; 'new': 0.61; 'browser': 0.61; 'received:173': 0.61; 'first': 0.61; '8bit%:100': 0.72; 'subject:get': 0.81; 'received:fios.verizon.net': 0.84; 'visitor': 0.84; 'vip': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Select fails when cookie tried to get a numeric value Date: Sat, 05 Oct 2013 18:06:44 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381010831 news.xs4all.nl 15951 [2001:888:2000:d::a6]:50066 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56223 On 10/5/2013 9:38 AM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE=91=CE=BB=CE=B5=CE= =BE=CF=8C=CF=80=CE=BF=CF=85=CE=BB=CE=BF=CF=82 wrote: > # initialize cookie > cookie =3D cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) > cookie.load( cookie ) > vip =3D cookie.get('ID') > > ....... > ....... > > # if browser cookie does not exist, set it > vip =3D random.randrange(0, 10000) > cookie['ID'] =3D vip > cookie['ID']['path'] =3D '/' > > # first time visitor on this page, create new record > cur.execute('''INSERT INTO visitors (counterID, cookieID, host, city, > useros, browser, ref, lastvisit) VALUES (%s, %s, %s, %s, %s, %s, %s, > %s)''', (cID, vip, host, city, useros, browser, ref, lastvisit) ) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > The above code i wrote gives me the following error: > > > [Sat Oct 05 13:33:24 2013] [error] [client 108.162.229.114] File > "/home/nikos/public_html/cgi-bin/metrites.py", line 209, in The prefix added to every line of the traceback by the logging process [Sat Oct 05 13:33:24 2013] [error] [client 108.162.229.114] makes the traceback much harder to read. I suggest removing it before=20 posting. This is easy with a global replace with nothing. If you control = the logging and can have the prefix printed just once, even better. -- Terry Jan Reedy