我得到错误:
ValueError:参数属于不受支持的类型
代码:
async def add(ctx, el: str, email: str, password: str):
con= sqlite3.connect("db.sqlite")
c = con.cursor()
c.execute("SELECT type FROM accounts WHERE type=?", (el,))
results = c.fetchall()
if len(results) == 0:
await ctx.send("there is no type with this")
else:
c.execute("UPDATE accounts SET type = ?, email = ?, password = ? ;", {el, email, password})
print("done")
await ctx.send("done")
con.commit()
con.close()
错误跟踪:
Ignoring exception in command add:
Traceback (most recent call last):
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 127, in wrapped
ret = await coro(arg)
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 911, in _invoke
await self.callback(ctx, **kwargs)
File "C:UsersuserDesktopSidthomain.py", line 42, in add
c.execute("UPDATE accounts SET type = ?, email = ?, password = ? ;", {el, email, password})
ValueError: parameters are of unsupported type
上述异常是以下异常的直接原因:
Traceback (most recent call last):
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordbot.py", line 1008, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 359, in invoke
await injected(ctx)
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: ValueError: parameters are of unsupported type
我现在觉得很笨,真想哭
问题是我在c.execute("UPDATE accounts SET type=?,email=?,password=?;"(我输入了{el,email,password}而不是(el,e-mail,password(。。。