【问题标题】:discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax errordiscord.errors.ApplicationCommandInvokeError:应用程序命令引发异常:OperationalError:靠近\“,\”:语法错误
【发布时间】:2022-11-02 04:43:54
【问题描述】:

当我试图从我的数据库(sqlite3)中删除特定的东西时,它给了我错误:discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error 由于某些原因,这是所需的代码:

c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))

顺便说一下,值 newresults[0] 和 newresults[1] 是在主代码中定义的。

这是完整的追溯:

Ignoring exception in command buy:
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 62, in buy
    c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))
sqlite3.OperationalError: near ",": syntax error

The above exception was the direct cause of the following exception:

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: OperationalError: near ",": syntax error

【问题讨论】:

    标签: python sqlite discord.py pycord


    【解决方案1】:

    您需要使用 AND:

    "DELETE FROM accounts WHERE email=? AND password=?"
    

    【讨论】:

      猜你喜欢
      • 2021-05-02
      • 1970-01-01
      • 2021-05-11
      • 2019-02-07
      • 2020-02-06
      • 2019-01-12
      • 2014-05-17
      • 2021-10-19
      • 2018-07-27
      相关资源
      最近更新 更多