when I run the pyrogram there is an error like this in my opinion this is because of the unstable replit network!!
Traceback (most recent call last):
File "main.py", line 44, in <module>
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
File "main.py", line 32, in run_all
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
is_authorized = await self.connect()
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 40, in connect
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/client.py", line 600, in load_session
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/session/auth.py", line 254, in create
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/session/auth.py", line 89, in create
res_pq = await self.invoke(raw.functions.ReqPqMulti(nonce=nonce))
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/session/auth.py", line 67, in invoke
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/session/auth.py", line 60, in unpack
File "/home/runner/Asta-Robot/venv/lib/python3.10/site-packages/pyrogram/raw/core/tl_object.py", line 33, in read
return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(b, *args)
Welcome to the forums!
Can you please send a link to the Repl?
can you help me about this problem?,because it happens to my repl a lot
Same issue , share if you got any solution
Can all of you please send links to the Repls that are facing issues? We can’t help you without 'em.
Checking OP’s post, this is probably the repl:
Just by looking at the error,
KeyError: 0 is probably raised because the code tried to get the value from a dictionary with the key value
Searching this error gives this response from a maintainer Error on connect · Issue #1249 · pyrogram/pyrogram · GitHub and Bot can't login without session and raise exception · Issue #219 · pyrogram/pyrogram · GitHub
Since this is a rare occurance, just catch the error and ignore it
pass #you may log it too, up to you
Is that Repl private? It returns a 404.
Turn on public mode for repl
Any sulutions for this problem?
I’m pretty sure it related to compatibility issue. The project will temporary fixed for a while if you kill the section by type
kill 1 in the shell.
It also happen with a simple code like this:
from pyrogram import Client
app = Client("bot", api_id, api_hash, bot_token)
I been having the same error for a few days and using the kill 1 command and sometimes the bot on it’s own fixed it self but it’s been two days that the bot has been totally offline and giving the same error and non of the methods given work .
I think this a connection issue and should be fixed by the Replit team .
Та ж сама помилка. Чи є рішення проблеми?
Yes I have the same problem too, Replit admins please fix this bug soon.
No, this is not a problem of accessing invalid key from a dictionary.
This is a network issue.
Mentioned in: Throws "KeyError: 0" exceptions when starts app · Issue #406 · pyrogram/pyrogram · GitHub