L
L
LulzLoL2312018-11-09 16:01:16
Python
LulzLoL231, 2018-11-09 16:01:16

I'm blind? Where is NoneType?

There is some code, it connects to the local SQLite database, and issues information from it to the user ...
Base - collection of TEXT expressions, no INTEGER, and even more so None (NULL).
When trying to display information, an error occurs: TypeError: 'NoneType' object is not
subscriptable
Part of the code with an error:

cur.execute('SELECT * FROM sometable WHERE ' + where + '=' + query)
fetch = cur.fetchone()
var0 = fetch[0]
var1 = fetch[1]
var2 = fetch[2]
var3 = fetch[3]
var4 = fetch[4]
var5 = fetch[5]
print('Result:')
print('VAR0: ' + var0)
print('VAR1: ' + var1)
print('VAR2: ' + var2)
print('VAR3: ' + var3)
print('VAR4: ' + var4)
print('VAR5: ' + var5)

Ps "where" and "query" are correct, they are passed as variables when calling the function where this code is specified...
Pss Python3
Psss The executable program is local, does not have access to the Internet, I'm not afraid of injections...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-11-09
@LulzLoL231

Where None sat down I don’t understand

After execution, the fetch = cur.fetchone()variable fetchisNone
And yet this query returns nothing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question