You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tryed to login and do some actions with telethon on my device. Telethon created session file, code worked fine. Then I moved this code and session file into my hosting provider's server. The CancelledError throws on this server.
There is my code:
from telethon import TelegramClient
with client:
client.loop.run_until_complete(main())
And error traceback:
Unexpected exception in the receive loop
Traceback (most recent call last):
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 332, in _recv_loop
data = await self._recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 369, in _recv
return await self._codec.read_packet(self._reader)
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/tcpfull.py", line 25, in read_packet
packet_len_seq = await reader.readexactly(8) # 4 and 4
File "/usr/lib/python3.6/asyncio/streams.py", line 674, in readexactly
yield from self._wait_for_data('readexactly')
File "/usr/lib/python3.6/asyncio/streams.py", line 464, in _wait_for_data
yield from self._waiter
concurrent.futures._base.CancelledError
Unhandled error while receiving data
Traceback (most recent call last):
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/mtprotosender.py", line 505, in _recv_loop
body = await self._connection.recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 301, in recv
raise err
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 332, in _recv_loop
data = await self._recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 369, in _recv
return await self._codec.read_packet(self._reader)
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/tcpfull.py", line 25, in read_packet
packet_len_seq = await reader.readexactly(8) # 4 and 4
File "/usr/lib/python3.6/asyncio/streams.py", line 674, in readexactly
yield from self._wait_for_data('readexactly')
File "/usr/lib/python3.6/asyncio/streams.py", line 464, in _wait_for_data
yield from self._waiter
concurrent.futures._base.CancelledError
The text was updated successfully, but these errors were encountered:
While "Unhandled error while receiving data" was a bug (solved by the above commit), the behavior should've been essentially the same.
If a disconnection occur it will exit.
I don't know why your provider disconnects the library but it's unlikely to be a problem with the library's code. Maybe the above fix will uncover the real cause.
* except and propagate TypeNotFoundError during update handling
* Better document breaking ToS will lead to bans
ClosesLonamiWebs#4102.
* Fix KeyError when ID is in cache but queried without mark
ClosesLonamiWebs#4084.
* Fix asyncio.CancelledError was being swallowed by inner except
ClosesLonamiWebs#4104.
* Add check for asyncio event loop to remain the same
* Update FAQ with more common questions
---------
Co-authored-by: Lonami Exo <totufals@hotmail.com>
I tryed to login and do some actions with telethon on my device. Telethon created session file, code worked fine. Then I moved this code and session file into my hosting provider's server. The CancelledError throws on this server.
There is my code:
from telethon import TelegramClient
Use your own values from my.telegram.org
api_id = *********
api_hash = '********************************'
The first parameter is the .session file name (absolute paths allowed)
client = TelegramClient('SessionTest', api_id, api_hash)
async def main():
await client.send_message('***********', 'SESSIONTEST')
with client:
client.loop.run_until_complete(main())
And error traceback:
Unexpected exception in the receive loop
Traceback (most recent call last):
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 332, in _recv_loop
data = await self._recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 369, in _recv
return await self._codec.read_packet(self._reader)
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/tcpfull.py", line 25, in read_packet
packet_len_seq = await reader.readexactly(8) # 4 and 4
File "/usr/lib/python3.6/asyncio/streams.py", line 674, in readexactly
yield from self._wait_for_data('readexactly')
File "/usr/lib/python3.6/asyncio/streams.py", line 464, in _wait_for_data
yield from self._waiter
concurrent.futures._base.CancelledError
Unhandled error while receiving data
Traceback (most recent call last):
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/mtprotosender.py", line 505, in _recv_loop
body = await self._connection.recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 301, in recv
raise err
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 332, in _recv_loop
data = await self._recv()
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/connection.py", line 369, in _recv
return await self._codec.read_packet(self._reader)
File "/home/i/ivashk1f/.local/lib/python3.6/site-packages/telethon/network/connection/tcpfull.py", line 25, in read_packet
packet_len_seq = await reader.readexactly(8) # 4 and 4
File "/usr/lib/python3.6/asyncio/streams.py", line 674, in readexactly
yield from self._wait_for_data('readexactly')
File "/usr/lib/python3.6/asyncio/streams.py", line 464, in _wait_for_data
yield from self._waiter
concurrent.futures._base.CancelledError
The text was updated successfully, but these errors were encountered: