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 am sure the error is coming from Pyrogram's code and not elsewhere
I have searched in the issue tracker for similar bug reports, including closed ones
I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version
Description
Error handling breaks when run under Python optimize level 2 (env PYTHONOPTIMIZE=2 or -OO command line flag). Seemingly it's because level 2 removes docstrings, and Pyrogram error formatting depends on them.
Ok, I might be weird to run things with -OO. Anyway, it would be nice to mention it in docs, check sys.flags.optimize or something else.
Steps to reproduce
Run Pyrogram app with PYTHONOPTIMIZE=2 or -OO
Encounter any error
See posted traceback
Code example
No response
Logs
Traceback (most recent call last):
- REDACTED -
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
returnfuture.result()
File "-REDACTED-/services/telegram.py", line 45, in apost_dailies
async with client:
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/client.py", line 311, in __aenter__
return await self.start()
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 62, in start
await self.authorize()
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/client.py", line 333, in authorize
return await self.sign_in_bot(self.bot_token)
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/methods/auth/sign_in_bot.py", line 51, in sign_in_bot
r = await self.invoke(
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/methods/advanced/invoke.py", line 79, in invoke
r = await self.session.invoke(
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/session/session.py", line 389, in invoke
return await self.send(query, timeout=timeout)
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/session/session.py", line 357, in send
RPCError.raise_it(result, type(data))
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it
raise getattr(
File "/usr/src/app/.venv/lib/python3.10/site-packages/pyrogram/errors/rpc_error.py", line 46, in __init__
self.MESSAGE.format(value=value),
AttributeError: 'NoneType' object has no attribute 'format'
The text was updated successfully, but these errors were encountered:
Checklist
pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
and reproduced the issue using the latest development versionDescription
Error handling breaks when run under Python optimize level 2 (env
PYTHONOPTIMIZE=2
or-OO
command line flag). Seemingly it's because level 2 removes docstrings, and Pyrogram error formatting depends on them.Ok, I might be weird to run things with
-OO
. Anyway, it would be nice to mention it in docs, checksys.flags.optimize
or something else.Steps to reproduce
PYTHONOPTIMIZE=2
or-OO
Code example
No response
Logs
The text was updated successfully, but these errors were encountered: