Answer the question
In order to leave comments, you need to log in
TypeError: 'NoneType' object is not subscriptable SQlite 3 (1,) What's the problem?
def license(ID):
try:
lock.acquire(True)
sql.execute(f"SELECT LIC FROM users WHERE ID = '{ID}'")
#print(sql.fetchone())
if print(sql.fetchone()) == None:
return 0#Нет ЛИЦ
elif print(sql.fetchone()[0]) == 1:
print('da')
return 1#Есть ЛИЦ
else:
return 0#Нет ЛИЦ
finally:
lock.release()
Answer the question
In order to leave comments, you need to log in
Reading the documentation :
Fetches the next row of a query result set, returning a single sequence, or None when no more data is available.
fetchone
to if print(sql.fetchone()) == None:
returns a result, but the second elif print(sql.fetchone()[0]) == 1:
does not.
Visit ti know more for above information: typeerror nonetype object is not subscriptable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question