我得到的错误是:
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:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 127, in wrapped
ret = await coro(arg)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 911, in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\user\Desktop\Sidtho\main.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:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1008, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
await injected(ctx)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: ValueError: parameters are of unsupported type
1条答案
按热度按时间plupiseo1#
我现在感觉好傻,我真的很想哭
问题是,在c.ecute(“UPDATE ACCOUNTS SET TYPE=?,EMAIL=?,PASSWORD=?;”)之后,我输入了一个{el,Email,Password}而不是(el,Email,Password)...