【发布时间】:2021-09-06 03:01:41
【问题描述】:
async def warnings(ctx,*,arg1):
#await ctx.send('Warning {} \nreason {}'.format(arg1))
print(arg1)
name=arg1
db.execute('SELECT name FROM warnings WHERE name = "?"', (name))
conn.commit()
warnings = db.fetchall()
print(warnings)
我试图在 sqlite 中为用户的警告进行搜索。但我有这个错误,我该如何解决这个问题 我做错了什么?
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "d:/_User/Desktop/Development/shop.py", line 279, in warnings
db.execute('SELECT name FROM warnings WHERE name = "?"', "{name}")
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 6 supplied.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Python38\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python38\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 6 supplied.
【问题讨论】:
标签: python sql sqlite discord discord.py