Answer the question
In order to leave comments, you need to log in
'coroutine' object is not iterable telethon?
Hello.
I have a code that simply displays the name of people/channels in dialogs:
from telethon import TelegramClient
api_id = secret
api_hash = "secret"
client = TelegramClient("anon", api_id, api_hash)
client.start()
dlgs = client.get_dialogs()
for dlg in dlgs:
print(dlg.title)
Traceback (most recent call last):
File "C:/Users/User/AppData/Local/Programs/Python/Python38-32/sxasac.py", line 9, in <module>
for dlg in dlgs:
TypeError: 'coroutine' object is not iterable
<coroutine object DialogMethods.get_dialogs at 0x041F22E8>
Answer the question
In order to leave comments, you need to log in
It's easiest to use the synchronous library instead of telethon. Or read the asyncio documentation, learn that asynchronous programs are not written this way. It is also useful to read the documentation of telethon itself, there are many examples.
First we learn the basics of python, then we move on to learning asyncio.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question