Question: Hi there! I faced a small problem. My app using Telegram API suddenly stopped working but it worked before. I found the reason of it. When I try to connect using pyrogram
or telethon
, I can’t do it. pyrogram
shows me error messages about empty packets (this is how I found the reason) and telethon
just doesn’t work but without any errors.
There is the easy script which doesn’t work:
from telethon import functions
from telethon.sync import TelegramClient
with TelegramClient('client', api_id, api_hash) as client:
client(functions.account.UpdateProfileRequest(about=some_string_declared_before))
Traceback (most recent call last):
File "/home/runner/some-repo/test.py", line 10, in <module>
with TelegramClient('client', api_id, api_hash) as client:
File "/home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/helpers.py", line 219, in _sync_enter
return loop.run_until_complete(self.__aenter__())
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 1863, in _run_once
event_list = self._selector.select(timeout)
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
Task was destroyed but it is pending!
task: <Task pending name='Task-5' coro=<MTProtoSender._send_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/mtprotosender.py:462> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-6' coro=<MTProtoSender._recv_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/mtprotosender.py:505> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Connection._send_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/connection/connection.py:311> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-4' coro=<Connection._recv_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/connection/connection.py:329> wait_for=<Future pending cb=[Task.task_wakeup()]>
There is nothing in the console and it doesn’t change my status in Telegram account, so I stopped the script by Ctrl+C and it shows me this traceback. It speaks of some problems with internet on Replit. How can I fix it?