V
V
Volodya2021-10-19 23:52:48
Python
Volodya, 2021-10-19 23:52:48

How to fix AttributeError: module 'telebot.types' has no attribute 'User' error?

import telebot
import sqlite3
from telebot import types
from random import randint

When importing, an error pops up:

Traceback (most recent call last):
  File "C:/Users/HOME/PycharmProjects/Кеша бот python/Новий бот-Ігра/main.py", line 3, in <module>
    from telebot import types
  File "C:\Users\HOME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\telebot\types.py", line 12, in <module>
    from telebot import util
  File "C:\Users\HOME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\telebot\util.py", line 307, in <module>
    def user_link(user: types.User, include_id: bool=False) -> str:
AttributeError: module 'telebot.types' has no attribute 'User'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-10-20
Burnout @vova1244

> C:\Users\HOME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ telebot \types.py Installed
via pip installbot? Congratulations, you installed the wrong package. You need the pyTelegramBotAPI package instead. Yes, there are two. Yes, both are imported as telebot. Yes, it's stupid. You just need to be more careful when you put dependencies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question