0
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)

im trying to make a serch for user's warning in sqlite. but i have this error with how can i fix this what am I doing wrong?

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.

1 Answers1

0

First result on Google is another SO post that answers your question. You need to make the arguments a tuple instead of a string by adding a comma at the end.

(name,)

Try to do minimal effort at researching the issue yourself before asking, this shouldn't take more than 5 seconds to find.

stijndcl
  • 5,294
  • 1
  • 9
  • 23