Answer the question
In order to leave comments, you need to log in
Why is sqlite3 not working?
I run the code:
import help_module as hm
import sqlite3
import time
connection = sqlite3.connect('Путь', check_same_thread = False)
cursor = connection.cursor()
while True:
for i in range(999999):
timer_status = hm.give_user_information2(i, 'timer', 'users')
if timer_status == 1:
neded_time = hm.give_user_information2(i, 'nt', 'users')
time = hm.give_user_information2(i, 'time', 'users')
if neded_time <= time:
vk.messages.send(
message=hm.give_user_information2(i, 'timer_text', 'users'),
peer_id=hm.give_user_information2(i, 'id', 'users'),
random_id=get_random_id()
)
cursor.execute("UPDATE users SET timer = 0 WHERE uid = " + str(i))
connection.commit()
cursor.execute("UPDATE users SET time = "+str(time.time())+" WHERE uid = " + str(i))
Traceback (most recent call last):
File "Путь", line 17, in <module>
timer_status = hm.give_user_information2(i, 'timer', 'users')
File "Путь\help_module.py", line 11, in give_user_information2
return str(cursor.execute("SELECT " + info + " FROM " + table + " WHERE uid = " + str(id)).fetchone()[0])
TypeError: 'NoneType' object is not subscriptable
def give_user_information2(id, info, table):
connection = sqlite3.connect('Путь')
cursor = connection.cursor()
return str(cursor.execute("SELECT " + info + " FROM " + table + " WHERE uid = " + str(id)).fetchone()[0])
timer_status = hm.give_user_information2(i, 'timer', 'users')
print(timer_status)
0
Traceback (most recent call last):
File "Путь", line 17, in <module>
timer_status = hm.give_user_information2(i, 'timer', 'users')
File "Путь\help_module.py", line 11, in give_user_information2
return str(cursor.execute("SELECT " + info + " FROM " + table + " WHERE uid = " + str(id)).fetchone()[0])
TypeError: 'NoneType' object is not subscriptable
Answer the question
In order to leave comments, you need to log in
1) sqlite always plows !!!!
2) The error occurs because you are trying to do this:
arr = None
arr[0]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question