Help me with this code PLEASE

Nick the Gr33k nikos.gr33k at gmail.com
Tue Nov 5 23:28:41 CET 2013


Στις 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?




More information about the Python-list mailing list