Python TypeError: not all arguments converted during string formatting
Код функции:
def create_poll(connection, title, owner, options):
with connection:
with connection.cursor() as cursor:
cursor.execute(INSERT_POLL_RETURN_ID, (title, owner))
#cursor.execute("SELECT id FROM polls ORDER BY id DESC LIMIT 1;")
poll_id = cursor.fetchone()[0]
option_values = [(option_text, poll_id) for option_text in options]
execute_values(cursor, INSERT_OPTION, option_values)
for option_value in option_values:
cursor.execute(INSERT_OPTION, option_value)
Логи:
Traceback (most recent call last):
File "D:\Programming\Python\Python+PostgreSQL_2.0\poll_app\app.py", line 103, in <module>
menu()
File "D:\Programming\Python\Python+PostgreSQL_2.0\poll_app\app.py", line 98, in menu
MENU_OPTIONS[selection](connection)
File "D:\Programming\Python\Python+PostgreSQL_2.0\poll_app\app.py", line 30, in prompt_create_poll
database.create_poll(connection, poll_title, poll_owner, options)
File "D:\Programming\Python\Python+PostgreSQL_2.0\poll_app\database.py", line 88, in create_poll
cursor.execute(INSERT_OPTION, option_value)
TypeError: not all arguments converted during string formatting