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've managed to get the math.sqrt working but not like indicated in the example. I moved the math.sqrt call to an asyncio aware section because if I don't, the interpreter complains about exactly this.
TypeError: An asyncio.Future, a coroutine or an awaitable is required
Edit: To be complete : I'm getting following error when using the apply() method:
RuntimeError: await wasn't used with future
_
My adaptation for the sqrt example:
import asyncio
import math
from aiomultiprocess import Pool
async def sqrt_task(data):
return math.sqrt(data)
async def main():
async with Pool() as pool:
data = [1, 4, 9, 16, 25]
results = await pool.map(sqrt_task, data)
print(results)
if __name__ == '__main__':
asyncio.run(main())
Details
OS: Ubuntu 22.04.1 LTS
Python version: 3.7.10
aiomultiprocess version: 0.9.0
Can you repro on master?
Can you repro in a clean virtualenv?
The text was updated successfully, but these errors were encountered:
Description
I can't execute the example code in the Process section. Both the apply() method as the map(math.sqrt) method.
Documentation
I've managed to get the math.sqrt working but not like indicated in the example. I moved the math.sqrt call to an asyncio aware section because if I don't, the interpreter complains about exactly this.
TypeError: An asyncio.Future, a coroutine or an awaitable is required
Edit: To be complete : I'm getting following error when using the apply() method:
RuntimeError: await wasn't used with future
_
My adaptation for the sqrt example:
Details
The text was updated successfully, but these errors were encountered: