Module telebot has no attribute telebot что делать
Перейти к содержимому

Module telebot has no attribute telebot что делать

  • автор:

Помогите! Проблема в python

Я не знаю что уже делать. Когда пишу бота по телеграмму и запускаю пишет такая хрень:
Traceback (most recent call last):
File «E:\PYTHON\bot.py», line 3, in
bot = telebot.Telebot(‘1951944916:AAGJWEKnTjGpxc87mvF2Ss502gS5ddTIZ50’, parse_mode=None)
AttributeError: module ‘telebot’ has no attribute ‘Telebot’. Did you mean: ‘TeleBot’
Помогите пожалуйста, установил последнюю версию pyTelegramBotAPI.

Лучший ответ

Так он же тебе пишет, что нет атрибута «Telebot», предлагает замену на «TeleBot»

СТЕПАН ЗЮБИНУченик (236) 2 года назад

Что это значит?

Diase 1 Мудрец (12537) СТЕПАН ЗЮБИН, я не особо сильно знаком с Пайтоном, речь идёт про строчку: «bot = telebot.Telebot», где есть это слово «Telebot», оно, наверное, неверно написано, правильный вариант — «TeleBot» ?

Иван НекрасовУченик (102) 2 года назад

Как исправить?

СТЕПАН ЗЮБИНУченик (236) 2 года назад

Щас попробую сделать эхо бота.

Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module ‘telebot’ has no attribute ‘TeleBot’ #19

Bimka09 opened this issue Dec 1, 2019 · 14 comments

AttributeError: module ‘telebot’ has no attribute ‘TeleBot’ #19

Bimka09 opened this issue Dec 1, 2019 · 14 comments

Comments

Bimka09 commented Dec 1, 2019 •

Не понимаю, в чём проблема
Версия pyTelegramBotAPI 3.6.6
OS Windows 10
Python version 3.7
Мой код
import telebot

bot = telebot.TeleBot(‘мой токен’)
@bot.message_handler(commands=[‘start’])

def start_message(message):
bot.send_message(message.chat.id, ‘Привет, ты написал мне /start’)

Ошибка:
Traceback (most recent call last):
File «C:/Users/User/PycharmProjects/CI2CBot/Bot.py», line 3, in
bot = telebot.TeleBot(‘921146718:’)
AttributeError: module ‘telebot’ has no attribute ‘TeleBot’

The text was updated successfully, but these errors were encountered:

pyTelegramBotAPI import error: AttributeError: module ‘telebot’ has no attribute ‘TeleBot’

Under normal circumstances, Python script calls pyTelegramBotAPI module with “import”:

import telebotdef telebot_send(message): 
bot = telebot.TeleBot(TOKEN)
bot.send_message(chat_id, message)

But sometimes a special error will occur: AttributeError: module ‘telebot’ has no attribute ‘TeleBot’. Two situations will result in this error.

  1. The same name python file called “telebot.py” exists under the same directory. “import telebot” will import the file rather than the module;

Solution

Rename the “telebot.py”.

2. A familiar module “telebot” also exists in Pypi. If someone wrongly installed it with “pip3 install telebot” instead of pyTelegramBotAPI, python script will import a different module that doesn’t have the attribute.

Solution

pip3 uninstall telebot
pip3 install pyTelegramBotAPI

Uninstalling the pyTelegramAPI is necessary, then reinstall the pyTelegramBotAPI module, it will working without attribute error.

PyTelegramBotApi. AttributeError: module ‘telebot’ has no attribute ‘TeleBot’

Из библиотек с ботами установлена только PyTelegramBotApi и с другими библиотеками не конфликтуют. Аргумент telebot.TeleBot() написан правильно.Через VPN запускать пробовал, аналогичная ошибка. При запуске скрипта с расширением **.py(имя скрипта не telebot) ругает первую строчку кода AttributeError: module ‘telebot’ has no attribute ‘TeleBot’. Все, что нашел в Google, все попробовал, в теле вопроса все расписал. Какие могут быть еще варианты решения. Спасибо за уделённое время.

import telebot MypyBot = telebot.TeleBot('TOKEN заменён на свой, получен от BotFather в Telegram', parse_mode = None) 

введите сюда описание изображения

Отслеживать
KillKimNovak
задан 6 окт 2020 в 21:13
KillKimNovak KillKimNovak
21 1 1 золотой знак 1 1 серебряный знак 4 4 бронзовых знака
как установлена библиотека? и спасибо за токен на скриншоте
9 окт 2020 в 7:47

3 ответа 3

Сортировка: Сброс на вариант по умолчанию

Во-первых — проверьте, установлена ли у вас библиотека, и установлена ли она у вас правильно. Для верности можно полностью ее удалить

pip uninstall pytelegrambotapi pip install --no-cache-dir pytelegrambotapi 

Проблема, вероятно, именно в самом установленном модуле, ибо даже ваш код у меня запускается абсолютно нормально. Как пример, небольшой эхо-бот:

import telebot MypyBot = telebot.TeleBot('TOKEN', parse_mode = None) @MypyBot.message_handler(content_types = ['text']) def replyer(message): MypyBot.reply_to(message, message.text) MypyBot.polling() 

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *