Riccardo
Riccardo

Reputation: 76

ImportError: cannot import name 'types'

When I try to deploy my telegram bot in heroku i get this error

ImportError: cannot import name 'types'

my requirements.txt

Click==7.0
Flask==1.0.2
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
requests==2.7.0
pyTelegramBotAPI==3.6.6
Werkzeug==0.14.1
requests==2.7.0

my imports

import telebot
import os
from telebot import types
from requests.exceptions import ConnectionError
from flask import Flask, request
import requests

How to fix this?

Upvotes: 1

Views: 10863

Answers (1)

Sssssuppp
Sssssuppp

Reputation: 711

It seems that there are issues on GitHub with this same question. This is what you could try

pip uninstall telebot
pip install pytelegrambotapi

After successful installation of this library, you can move to writing something like this:

import telebot
bot = telebot.TeleBot("TOKEN")

Also, this documentation here should give you an idea of how to accomplish whatever your trying to do

Good Luck!

Upvotes: 4

Related Questions