Answer the question
In order to leave comments, you need to log in
Error while working with q sqlite table. What to do?
I have this code:
def pay(message):
token = config.CONFIG['qiwi']
phone = config.CONFIG['phone']
db = sqlite3.connect('users.db')
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS users (
user_id TEXT,
qrule TEXT,
cash INTEGER,
usersinbot INTEGER,
pay TEXT,
pay_money INTEGER
)""")
price = message.text
api = QApi(token=token, phone=phone)
if not price.isdigit():
client.send_message(message.chat.id, 'Введите коректное значение')
main(message)
return
price = int(price)
comment = api.bill(price)
cursor.execute(f"UPDATE users SET pay = {str(comment)} WHERE user_id = '{message.chat.id}'")
db.commit()
cursor.execute(f"UPDATE users SET pay_money = {price} WHERE user_id = '{message.chat.id}'")
db.commit()
markup_inline = types.InlineKeyboardMarkup()
item_pay = types.InlineKeyboardButton(text = 'Оплатить', url='link_to_pay')
item_check = types.InlineKeyboardButton(text = 'Проверить платёж', callback_data='check')
item_back = types.InlineKeyboardButton(text = 'Назад', callback_data='bck')
markup_inline.add(item_pay)
markup_inline.add(item_check)
markup_inline.add(item_back)
client.send_message(message.chat.id, f'Для перехода к оплате нажмите кнопку оплатить и в комментариях к оплате оставьте код: {comment}. Если вы не оставите код то бот не примет платёж. В сумме для оплаты указывайте такое же число что вы отправили ранее.', reply_markup=markup_inline)
Traceback (most recent call last):
File "c:/Users/Дом/Desktop/Py/PY/tg_bot_frilance/main.py", line 369, in <module>
client.polling(none_stop=True, interval=0)
File "C:\Users\Дом\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 619, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout, allowed_updates)
File "C:\Users\Дом\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 678, in __threaded_polling
raise e
File "C:\Users\Дом\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 641, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\Дом\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 130, in raise_exceptions
raise self.exception_info
File "C:\Users\Дом\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 82, in run
task(*args, **kwargs)
File "c:/Users/Дом/Desktop/Py/PY/tg_bot_frilance/main.py", line 99, in pay
cursor.execute(f"UPDATE users SET pay = {str(comment)} WHERE user_id = '{message.chat.id}'")
sqlite3.OperationalError: unrecognized token: "472f"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question