Answer the question
In order to leave comments, you need to log in
aiosqlite error how to fix?
I tried to make an automatic code for sending requests as in SQLite3 (Everything worked fine there) and an error appeared, I suffered for 30 minutes and did not understand what the problem was :(
async def post_sql_query_fetchone(call): #1 значение
async with aiosqlite.connect("all.db") as cu:
try:
await cu.execute(call)
except Error:
pass
result = await cu.fetchone()
return(result)
def create_tables():
users_query = '''CREATE TABLE IF NOT EXISTS USERS
(id INTEGER PRIMARY KEY NOT NULL);'''
post_sql_query_fetchone(users_query)
create_tables()
Answer the question
In order to leave comments, you need to log in
post_sql_query_fetchone returns a coroutine that you don't execute in the event loop. Don't use async libraries if you don't know asyncio.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question