I'm trying to use multi-processing on windows 10 with Python 3.10.1. If the method has a decoration, then this code fails:
from multiprocessing import Process
def profiler(func):
def wrap(*args, **kwargs):
result = func(*args, **kwargs)
return result
return wrap
@profiler
def go_around(num):
print(num)
if __name__ == '__main__':
p = Process(target=go_around, args=(1,))
p.start()
p.join()
I'm getting this error:
File "", line 1, in File "C:\Python\Python310\lib\multiprocessing\spawn.py", line 102, in spawn_main source_process = _winapi.OpenProcess( OSError: [WinError 87] The parameter is incorrect
Note that this used to work on python 2.7. Any ideas why this is happening and how to fix it?