aiomultiprocess
aiomultiprocess copied to clipboard
_pickle.PicklingError: Can't pickle <function get at 0x12cb5ea60>: attribute lookup get on __main__ failed
trafficstars
Description
import asyncio
from aiohttp import request
from aiomultiprocess import Pool # todo
async def get(url):
async with request("GET", url) as response:
return await response.text("utf-8")
async def mainmain():
urls = ["https://www.baidu.com"]*10
async with Pool() as pool:
results = await pool.map(get, urls)
return results
if __name__ == '__main__':
# Python 3.7
asyncio.run(mainmain())
Details
- OS: macos
- Python version: 3.8
- aiomultiprocess version: 0.9
- Can you repro on master?
- Can you repro in a clean virtualenv?
In the sample, there is some code that cannot be compiled normally. Did the author not test each piece individually when writing the documentation?