我得到錯誤:
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
uj5u.com熱心網友回復:
我現在感覺好傻好想哭
問題是我在 c.execute("UPDATE accounts SET type = ?, email = ?, password = ? ;") 之后做了一個 {el, email, password} 而不是 (el, email, password)。 ..
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/533340.html
上一篇:使用EF核心構建現有SQLite資料庫會導致通用背景關系且表沒有物體
下一篇:嵌套物件訪問原始物件的屬性
