Closed JaskaranSM closed 1 year ago
Can you reliably trigger this error? If the answer is yes and you add a print(self.date)
before returning in:
What does it show?
Can you reliably trigger this error? If the answer is yes and you add a
print(self.date)
before returning in:What does it show? added:
def get_difference(self): print(f"Getting difference with date={self.date} for={self.getting_diff_for}")
traceback:
Getting difference with date=1970-01-01 00:00:00+00:00 for={<object object at 0x000001A2363C6280>} [E 221113 10:37:32 updates:384] Fatal error handling updates (this is a bug in Telethon, please report it) Traceback (most recent call last): File "C:\Users\jaska\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\updates.py", line 282, in _update_loop diff = await self(get_diff) File "C:\Users\jaska\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\users.py", line 30, in __call__ return await self._call(self._sender, request, ordered=ordered) File "C:\Users\jaska\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\users.py", line 84, in _call result = await future telethon.errors.rpcerrorlist.DateEmptyError: Date empty (caused by GetDifferenceRequest)
It is strange but the date is indeed 0. It should have been initialized when you logged in but for some reason it was not. If you print((await client(functions.updates.GetStateRequest())).stringify())
, is the date
the same as above?
The library could pretend there was no gap when attempting to get difference and the date
is not known yet. A naive implementation might get in a loop however so perhaps a different fix would be needed. If you login again the error should disappear though (but I'd still like to fix this).
No, its not State( pts=46220, qts=0, date=datetime.datetime(2022, 11, 13, 17, 44, 54, tzinfo=datetime.timezone.utc), seq=311, unread_count=44 )
I cannot reproduce this issue myself. Please install master with:
pip3 install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and configure logging
with something like this:
import logging
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING)
logging.getLogger('telethon.messagebox').setLevel(logging.NOTSET + 1)
(You can configure it to your liking, but the messagebox
level must be as low as possible. If you have multiple TelegramClient
, please set a different base_logger='name'
for each in their constructor).
This will print all updates being processed along with the current state of the MessageBox
(which deals with the updates).
This log will contain sensitive information, so only share it with people you trust (or redact it before sharing it). You can send it to me privately so that I and nobody else can analyze it (please link to this issue, so I know you're not spam).
With it I'll be able to reproduce the issue reliably locally, pinpoint the problem, and fix it.
Closing due to inactivity.
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.Code that causes the issue
Traceback
Reporting the bug here as the traceback suggested to do.