`ValueError: no active connection` using aiosqlite

42 Views Asked by At

im pretty sure i have everything written correctly here! yet i keep getting an error, ValueError: no active connection the error points to in inventory cursor = await con.cursor() this is my full code

import aiosqlite

async def db ():
     async with aiosqlite.connect('inventory.db') as con:
         return con

async def inventory():
        con = await db()
        cursor = await con.cursor()
        await cursor.execute("CREATE TABLE inventory (user, dupes, name, char, rarity, image1, thumbnail1, image2, thumbnail2, UNIQUE (user, name, char))")
        await con.commit()
        await con.close()
        await cursor.close()

ive tried reordering the commit/close every way i can think of, im just really not sure? any help is appreciated! also fair warning- im essentially a complete noob w coding as of right now

0

There are 0 best solutions below