I have a script where messages from telegram are read and processed. There is also a simple GUI which shows a list of available channels/chats.
I'm testing it on various computers and different phone numbers/clients.
Only in 1 case, just one, when 1 message is received I get this exception (which also freezes the GUI, but this is another problem)
2020-03-25 12:59:58,985 : Unhandled exception on on_msg_received
Traceback (most recent call last):
File "site-packages\telethon\client\updates.py", line 428, in _dispatch_update
File "tele_test.py", line 963, in on_msg_received
File "site-packages\telethon\requestiter.py", line 75, in __anext__
File "site-packages\telethon\client\dialogs.py", line 53, in _load_next_chunk
File "site-packages\telethon\client\users.py", line 108, in __call__
ValueError: Request was unsuccessful 6 time(s)
any idea what could be the cause?
thanks
this is the code section where the problem happens:
async def on_msg_received( self, event ):
now = datetime.now()
hour = now.hour
minute = now.minute
chat_name = ''
async for dialog in self.cl.iter_dialogs():
if( dialog.id == event.chat_id ):
chat_name = dialog.name
logging.warning('------- chat = %s', chat_name )
t = event.raw_text
where line 963 showed in the error is:
async for dialog in self.cl.iter_dialogs():