Получаю вот такую ошибку при скачивании файла
Вот код:
@bot.message_handler(content_types=['photo'])
def handle_file(message):
file_info = bot.get_file(message.photo.file_id)
downloaded_file = bot.download_file(file_info.file_path)
src = filepath + message.photo.file_id
with open(src, 'wb') as new_file:
new_file.write(downloaded_file)
РАБОЧИЙ КОД:
file_info = bot.get_file(message.photo[0].file_id)
downloaded_file = bot.download_file(file_info.file_path)
src = '/home/pi/' + message.photo[0].file_id
with open(src, 'wb') as new_file:
new_file.write(downloaded_file)