Fix deprecation in asyncio.wait
Closed this issue · 0 comments
AlexanderWells-diamond commented
When you try and use PandABlocks-client in new versions of Python you see this warning:
DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11
This happens here: https://github.com/PandABlocks/PandABlocks-client/blob/master/pandablocks/asyncio.py#L35
One fix is to manually create the task: asyncio.create_task(writer.drain())
and pass that into the asyncio.wait
function instead.
NOTE: A reference to the task must be maintained for the lifetime of the task, as per documentation