@m1sla
Начинающий программист

Ошибка на aiogram Task exception was never retrieved, что делать?

Сама Ошибка
dispatcher.py [ LINE:336 ]#    INFO [2020-11-19 15:12:39,318]  Start polling.
base_events.py [ LINE:1707 ]#   ERROR [2020-11-19 15:12:41,739]  Task exception was never retrieved
future: <Task finished name='Task-7' coro=<Dispatcher._process_polling_updates() done, defined at C:\Users\IRU\A
ite-packages\aiogram\dispatcher\dispatcher.py:380> exception=BadRequest("Wrong remote file identifier specified:
Traceback (most recent call last):
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\dispatcher.py",
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\dispatcher.py",
    return await asyncio.gather(*tasks)
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\handler.py", li
    response = await handler_obj.handler(*args, **partial_data)
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\dispatcher.py",
    return await self.message_handlers.notify(update.message)
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\dispatcher\handler.py", li
    response = await handler_obj.handler(*args, **partial_data)
  File "bot.py", line 28, in process_photo_command
    await bot.send_photo(message.from_user.id, MUSICS,
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\bot\bot.py", line 486, in
    result = await self.request(api.Methods.SEND_PHOTO, payload, files)
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\bot\base.py", line 208, in
    return await api.make_request(self.session, self.server, self.__token, method, data, files,
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\bot\api.py", line 140, in
    return check_result(method, response.content_type, response.status, await response.text())
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\bot\api.py", line 115, in
    exceptions.BadRequest.detect(description)
  File "C:\Users\IRU\AppData\Local\Programs\Python\Python38\lib\site-packages\aiogram\utils\exceptions.py", line
    raise cls(description)
aiogram.utils.exceptions.BadRequest: Wrong remote file identifier specified: can't unserialize it


Код в файле bot.py
import asyncio
import logging
from aiogram import Bot, types
from aiogram.utils import executor
from aiogram.utils.emoji import emojize
from aiogram.dispatcher import Dispatcher
from aiogram.types.message import ContentType
from aiogram.utils.markdown import text, bold, italic, code, pre
from aiogram.types import ParseMode, InputMediaPhoto, InputMediaVideo, ChatActions

from config import TOKEN
import keyboards as kb


bot = Bot(token=TOKEN)
dp = Dispatcher(bot)

logging.basicConfig(format=u'%(filename)s [ LINE:%(lineno)+3s ]#%(levelname)+8s [%(asctime)s]  %(message)s',
                    level=logging.INFO)

MUSICS = 'AgACAgIAAxkBAAJbjl1TAXBtO6yLrvNnAVayxtBnxpAAIIsDEbwdwSdHp8WJpzAUEBnnly4AAwEAAwIAA3gAA9c2AwABHgQ'



@dp.message_handler(commands=['photo'])
async def process_photo_command(message: types.Message):
    caption = 'Какие глазки! :eyes:'
    await bot.send_photo(message.from_user.id, CAT_BIG_EYES,
                         caption=emojize(caption),
                         reply_to_message_id=message.message_id)
    
@dp.message_handler(commands=['help'])
async def process_help_command(message: types.Message):
    await message.reply("Нажми на кнопку и я отправлю тебе рандомную песню!")


@dp.message_handler()
async def echo_message(msg: types.Message):
    await bot.send_message(msg.from_user.id, msg.text)

if __name__ == '__main__':
    executor.start_polling(dp)


Код в файле config.py :
TOKEN = 'мой токен'

Код в файле с клавой
from aiogram.types import ReplyKeyboardRemove, \
    ReplyKeyboardMarkup, KeyboardButton, \
    InlineKeyboardMarkup, InlineKeyboardButton

button_hi = KeyboardButton('Нажми сюда и получи свою музыку!!! ')

greet_kb = ReplyKeyboardMarkup(resize_keyboard=True)
greet_kb.add(button_hi)


Вот такая вот проблема, помогите мне с этим.
  • Вопрос задан
  • 2525 просмотров
Пригласить эксперта
Ответы на вопрос 1
2ord
@2ord
https://stackoverflow.com/questions/42697723/teleg...
Вот тут куча советов. Пробуйте гуглить сами по названию ошибки.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы