Help me with this code PLEASE

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Nov 5 17:44:17 EST 2013


On 05/11/2013 22:28, Nick the Gr33k wrote:
> Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε:
>> In <l5bnpc$71v$1 at dont-email.me> Nick the Gr33k <nikos.gr33k at gmail.com>
>> writes:
>>
>>>         # fetch those columns that act as lists but are stored as
>>> strings
>>>         cur.execute('''SELECT refs, visits, downloads FROM visitors
>>> WHERE
>>> counterID = %s and host = %s''', (cID, host) )
>>>         data = cur.fetchone()
>>
>>>         if cur.rowcount:
>>>             # unpack data into variables
>>>             (ref, visit, download) = data
>>>
>>>             visit = visit.split()
>>>
>>> [Tue Nov 05 23:21:52 2013] [error] [client 176.92.96.218]     visit =
>>> visit.split()
>>> [Tue Nov 05 23:21:52 2013] [error] [client 176.92.96.218]
>>> AttributeError: 'NoneType' object has no attribute 'split'
>>
>> It appears that in the row you're fetching from the visitors table, the
>> 'visits' column is NULL.
>>
>> Your next step is track down why.
>
> Indeed.
>
> The code i provided only worked once before it failed and managed to
> store this:
>
>
> counterID,host,refs,city,userOS,browser,visits,hits,download
> -------------------------------------------------------------
> 1, 176-92-96-218.adsl.cyta.gr, Europe/Athens, Windows, Chrome,
> 0000-00-00 00:00:00, 1, ''
>
> 'visit's column is full of zeroes. Perhaps this is considered  as Null
> for Python?
>
> But ref is also null, why the code didn't complain for 'ref' which is
> retrieved just before 'visits'?
>
> How, i eman what si the way to investigate this further?
>

Don't worry about it.  Just leave it with the crack team that I've put 
together for you.  We should have some answers some time tomorrow.

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list