@Jesus_Christophe

Telegram bot: 'cannot cannot import name 'Animation' from 'telegram', как избавиться от ошибки?

При импорте telegram.ext выходит ошибка
ImportError: cannot import name 'Animation' from 'telegram' (unknown location)

Я пробовал удалять telegram, но ошибка не исчезает. До этого работало корректно.
  • Вопрос задан
  • 1348 просмотров
Решения вопроса 1
@PavelMos
Анимейшн это первый пункт в модуле телеграм при загрузке составляющих пакета
Возможно, не загрузился модуль телеграм вообще, не правильно установлен, не обновилась среда после установки.

#!/usr/bin/env python
# pylint: disable=E0611,E0213,E1102,E1101,R0913,R0904
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2022
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program.  If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram Bot."""

import functools
import logging
import warnings
from datetime import datetime

from typing import (
    TYPE_CHECKING,
    Callable,
    List,
    Optional,
    Tuple,
    TypeVar,
    Union,
    no_type_check,
    Dict,
    cast,
    Sequence,
)

try:
    import ujson as json
except ImportError:
    import json  # type: ignore[no-redef]  # noqa: F723

try:
    from cryptography.hazmat.backends import default_backend
    from cryptography.hazmat.primitives import serialization

    CRYPTO_INSTALLED = True
except ImportError:
    default_backend = None  # type: ignore[assignment]
    serialization = None  # type: ignore[assignment]
    CRYPTO_INSTALLED = False

from telegram import (
    Animation,
    Audio,
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы