aiogram.utils.exceptions.ValidationError: Media group must include 2-10 items as written in docs, but also it works with 1 element
def medlink(n):
with open('pnglinks.txt') as file:
res = file.readlines()[n-1:n]
print(res[0])
return res[0]
@dp.callback_query_handler(Text(startswith='n-'))
async def send_theory(call:types.CallbackQuery):
actnum = call.data.split('-')[1]
if actnum == '1':
media = [InputMediaPhoto(photo) for photo in medlink(1)]
await call.message.answer_media_group(media)
await call.message.delete()
await call.message.answer(text='1_Кинематика',reply_markup=InlineKeyboardMarkup(row_width=1).add(InlineKeyboardButton(text='↪Назад',callback_data='tospravka')).add(InlineKeyboardButton(text='⬅Гл.Меню',callback_data='main_menu')))
await call.answer()
Почему этот код вызывает такую ошибку?
aiogram.utils.exceptions.ValidationError: Media group must include 2-10 items as written in docs, but also it works with 1 element.
Если возвращаемый аргумент такой:
fiz1 = ['https://cdn.discordapp.com/attachments/770344822955049022/1090335575074156595/1_kinematika-1.png','https://cdn.discordapp.com/attachments/770344822955049022/1090335575321624626/1_kinematika-2.png','https://cdn.discordapp.com/attachments/770344822955049022/1090335575560704070/1_kinematika-3.png']
Источник: Stack Overflow на русском