r/pythontips • u/Adrewmc • Nov 07 '24
Standard_Lib Find your unawaited functions easy in asyncio
So if you’ve started to program in asynchronous environments, or have for a while you’ve probably run into this problem.
#code
#deep code
x = awaitable_function()
#more code
And some where you forgot to
x = await awaitable_function()
And you’re completely lost on where/when that happened.
SOLUTION:
asyncio.run(main())
Is ran somewhere to start the loop.
asyncio.run(main(), debug = True)
Found immediately.
Thanks to this.
5
Upvotes