Last active
May 14, 2024 14:51
-
-
Save canabady/f4b2195c3dc68474ffbe92839f3f9e2a to your computer and use it in GitHub Desktop.
Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied | |
# You need to pass in a sequence, but you forgot the comma to make your parameters a tuple: | |
cursor.execute('INSERT INTO images VALUES(?)', (img,)) | |
# Without the comma, (img) is just a grouped expression, not a tuple, and thus the img string is treated as the input sequence. If that string is 74 characters long, then Python sees that as 74 separate bind values, each one character long. | |
>>> len(img) | |
74 | |
>>> len((img,)) | |
1 | |
# If you find it easier to read, you can also use a list literal: | |
cursor.execute('INSERT INTO images VALUES(?)', [img]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment