Загрузка...

How to fix the error?

Thread in Python created by bern_code Mar 31, 2025. 128 views

  1. bern_code
    bern_code Topic starter Mar 31, 2025 4 Feb 11, 2025
    Здравствуйте, столкнулся с ошибкой( в боте не создается зеркало, точнее кнопка не открывается, после пе нажатия должен токен бота запрашивать, а там не открывается просто.
    Вот ошибка:
    Traceback (most recent call last):
    File "/usr/local/lib/python3.10/dist-packages/aiogram/dispatcher/dispatcher.py", line 415, in _process_polling_updates
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
    File "/usr/local/lib/python3.10/dist-packages/aiogram/dispatcher/dispatcher.py", line 235, in process_updates
    return await asyncio.gather(*tasks)
    File "/usr/local/lib/python3.10/dist-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
    File "/usr/local/lib/python3.10/dist-packages/aiogram/dispatcher/dispatcher.py", line 283, in process_update
    return await self.callback_query_handlers.notify(update.callback_query)
    File "/usr/local/lib/python3.10/dist-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
    File "/root/rpt/Worker/bot.py", line 2624, in handle_add_token
    user_bot = c.execute("SELECT * FROM tokens WHERE user_id = ? AND bot_type = ?", (call.from_user.id, call.data.split('_')[2])).fetchone()
    IndexError: list index out of range

    Скрины кода(строки 2624):
    [IMG]
    [IMG]

    За помощь закину если поможете, а кто просто поможет от души, уважение
     
  2. n1s_01
    Выходит за передел списка, у тебя обращение к 3-му элементу когда их меньше 3 (к 2 индексу обращаешься)
     
  3. Окулист
    Окулист Apr 16, 2025 Мы вас пока лечим 249 Nov 18, 2022
Top
Loading...