Following is the function I want to call using multiprocessing:
def Y_X_range(ranges, dim, Ymax, Xmax):
print('len: ', ranges, dim)
for i in enumerate(ranges):
if i[0] == 0 or i[0] == 2:
Yi = 0
while (Yi * dim < Ymax):
ranges[i[0]] += [-1]
Yi = Yi + 1
elif i[0] == 1 or i[0] == 3:
Xi = 0
while (Xi * dim < Xmax):
ranges[i[0]] += [-1]
Xi = Xi + 1
return ranges[0]
If I try to call the function using codes:
ranges = [[], [], [], []]
p = multiprocessing. Pool()
result = p.map(Y_X_range, ranges, dim, Ymax, Xmax)
Then I get an error message stating:
result = p.map(Y_X_range, ranges, dim, Ymax, Xmax)
TypeError: map() takes from 3 to 4 positional arguments but 6 were given
Can anyone tell me how can I pass values for all the parameters in Y_X_range(ranges, dim, Ymax, Xmax)?