-
Автор темы
- #1
python:
import asyncio
import aiosqlite
async def dbdef() -> None:
db = await aiosqlite.connect('db.db')
cursor = await db.execute('CREATE TABLE IF NOT EXISTS USERFRUITS')
await cursor.close()
await db.close()
asyncio.run(dbdef())
взял это с readme библиотки но у меня вызывает ошибку
Traceback (most recent call last):
File "d:\bloxfruitstockbot\test.py", line 10, in <module>
asyncio.run(dbdef())
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 684, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "d:\bloxfruitstockbot\test.py", line 6, in dbdef
cursor = await db.execute('CREATE TABLE IF NOT EXISTS USERFRUITS')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 190, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 133, in _execute
return await future
^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 106, in run
result = function()
^^^^^^^^^^
sqlite3.OperationalError: incomplete input
File "d:\bloxfruitstockbot\test.py", line 10, in <module>
asyncio.run(dbdef())
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 684, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "d:\bloxfruitstockbot\test.py", line 6, in dbdef
cursor = await db.execute('CREATE TABLE IF NOT EXISTS USERFRUITS')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 190, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 133, in _execute
return await future
^^^^^^^^^^^^
File "C:\Users\tcc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiosqlite\core.py", line 106, in run
result = function()
^^^^^^^^^^
sqlite3.OperationalError: incomplete input