multiprocessing Pool can't pickle local function, what am I doing wrong
Python 3.10, using multiprocessing.Pool.map() with a function defined inside another function. I get _pickle.PicklingError: Can't pickle <function worker at 0x7f8b1c>: attribute lookup worker on __main__ failed. I read that pickle needs importable functions, but I'm running from a script, not a REPL. Is there a way to pass a closure, or do I have to move it to module level? The traceback ends with the error raised from pool.py line 1027 in get.
4 replies