Open TheZavitaev opened 2 years ago
Вообще, их там много :)
except pyrogram.errors.FloodWait as exception:
перезапишет твою переменную
А там ваще костыли какие-то, надо переделать :)
А, вот почему так. https://docs.python.org/3/reference/compound_stmts.html#the-try-statement
When an exception has been assigned using as target, it is cleared at the end of the except clause. This is as if
except E as N: foo
was translated to
except E as N: try: foo finally: del N
This means the exception must be assigned to a different name to be able to refer to it after the except clause. Exceptions are cleared because with the traceback attached to them, they form a reference cycle with the stack frame, keeping all locals in that frame alive until the next garbage collection occurs.
https://github.com/Danstiv/cm-assistant/blob/master/tgbot/exception_handler.py#L114