I am writing the following code:
from multiprocessing import Pool
import defs
variables = ['Temp'] # variables used for the clustering analysis
if __name__ == '__main__':
num_processors = 3
p=Pool(processes = num_processors)
output = list(p.imap(defs.f,variables))
where defs is a file that contains the function f which simply reads a netcdf file with xarray.
But I get the error:'TypeError("cannot pickle '_thread.lock' object")
in multiprocessing.pool().
I have Windows 10 and Python 3.9.12. Any help?