sqlite3.ProgrammingError: Cannot operate on a closed cursor.
Closed this issue · 3 comments
xytrux commented
Bot Ready
Ignoring exception in command level:
Traceback (most recent call last):
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/discord/commands/core.py", line 980, in _invoke
await self.callback(ctx, **kwargs)
File "/home/helloworldpy103/LevelUp/main.py", line 105, in level
levelsys = await cursor.fetchone()
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/aiosqlite/cursor.py", line 54, in fetchone
return await self._execute(self._cursor.fetchone)
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/aiosqlite/cursor.py", line 31, in _execute
return await self._conn._execute(fn, *args, **kwargs)
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/aiosqlite/core.py", line 137, in _execute
return await future
File "/home/helloworldpy103/.local/lib/python3.9/site-packages/aiosqlite/core.py", line 110, in run
result = function()
sqlite3.ProgrammingError: Cannot operate on a closed cursor.
Thanks a lot, waff.
thrzl commented
https://github.com/PurpLabs/LevelUp/blob/85a5b34226edf0574f7d6891cfde7b7e5f9eb031/main.py#L103-L105
await cursor.fetchone()
should also be indented, because the end of the block closes the cursor.
xytrux commented
https://github.com/PurpLabs/LevelUp/blob/85a5b34226edf0574f7d6891cfde7b7e5f9eb031/main.py#L103-L105
await cursor.fetchone()
should also be indented, because the end of the block closes the cursor.
This doesn't exactly help. It just generates indentation errors in some areas.
thrzl commented
there were a few more places where indentation caused cursor
to attempt to be used outside of the with
block. this is fixed now though!