Telethon: ImportError: cannot import name 'TelegramClient'

Hello, I have just tried to setup a client but i’m receiving an import error: ImportError: cannot import name 'TelegramClient'

I installed telethon module with pip3 and tried to run the script with python 3. Is there something I’m missing here?

Thank you in advance!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 49 (21 by maintainers)

Commits related to this issue

Most upvoted comments

The error occurs because the file has the same name of package (telethon)

image

@Lonami 您好(hello),I tried a lot of things but it didn’t work. It’s working before Friday. but , I changed an account yesterday.

Telethon 1.0rc1 python 3.3.6

username='me' no username='first name..' no username='@username' no username='username' no

The group name contains empty spaces is not work:

Traceback (most recent call last): File "test.py", line 38, in <module> for message in client.get_messages('GSENetwork Official'): File "/data/pyenv/py31/lib/python3.6/site-packages/telethon/telegram_client.py", line 1358, in get_messages msgs = UserList(self.iter_messages(*args, **kwargs)) File "/data/pyenv/py31/lib/python3.6/collections/__init__.py", line 1039, in __init__ self.data = list(initlist) File "/data/pyenv/py31/lib/python3.6/site-packages/telethon/telegram_client.py", line 1203, in iter_messages entity = self.get_input_entity(entity) File "/data/pyenv/py31/lib/python3.6/site-packages/telethon/telegram_client.py", line 2807, in get_input_entity return utils.get_input_peer(self._get_entity_from_string(peer)) File "/data/pyenv/py31/lib/python3.6/site-packages/telethon/telegram_client.py", line 2769, in _get_entity_from_string 'Cannot find any entity corresponding to "{}"'.format(string) ValueError: Cannot find any entity corresponding to "GSENetwork Official"