Closed inyutin closed 4 years ago
This problem is known.
In normal case you must see warning from aiohttp about unclosed client session on application finalization but in some cases python can finalize libraries before Bot.__del__
is done and the you can get unexpected behavior like this.
Current finalization solution in framework works perfectly in previous python minor versions but in the last versions is not works.
Now i don't see optimal solutions without breaking backward compatibility in 2.x branch but i already done this in the next major version (3.0a) and it will be released soon (i think in few months).
Also i think i can make throwing explicit warning in bot destruction method. I'll try it.
And in Python 3.8.2 i don't see this exception. That is magic
To be accurate, error on Python3.7.4, aiohttp3.6.2, aiogram2.8
Thank you for fast response. Its all clear now. Aiolibs is such a destruction magic sometimes. Probably you can just mention this problem in QuickStart guide. Maybe as a comment on echobot
First of all, I want to thank you for this project. It's awesome!
Is your feature request related to a problem? Please describe. I was playing with echo-bot example from documentation. I made code that looks like this:
However, it doesn't work. So, I get an error:
By this error I dont understand what's going on. After 15-20 minutes I found out that forgot about
executor.start_polling(dp, skip_updates=True)
. I found missing line only by looking at the difference between my code and echo example code.Describe the solution you'd like I suggest more explicit error at least.
Describe alternatives you've considered However I don't understand why
start_polling
line is mandatory. Why can't I just create bot, but don't fetch updates?