Select fails when cookie tried to get a numeric value

Terry Reedy tjreedy at udel.edu
Sat Oct 5 18:06:44 EDT 2013


On 10/5/2013 9:38 AM, Νίκος Αλεξόπουλος wrote:
> # initialize cookie
> cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )
> cookie.load( cookie )
> vip = cookie.get('ID')
>
> .......
> .......
>
> # if browser cookie does not exist, set it
> vip = random.randrange(0, 10000)
> cookie['ID'] = vip
> cookie['ID']['path'] = '/'
>
> # 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) )
> =======================================
> 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 <module>

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 
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





More information about the Python-list mailing list