Answer the question
In order to leave comments, you need to log in
Multiprocessing module object not iterable?
import multiprocessing as mp
def washer(dishes, output):
for dish in dishes:
print('Washing ' ,dish, 'dish')
output.put(dish)
def dryer(input):
while True:
dish = input.get()
print('Drying ', dish , 'dish')
input.task_done()
dish_queue = mp.JoinableQueue()
dryer_proc = mp.Process(target = dryer , args = (dish_queue,))
dryer_proc.daemon = True
dryer_proc.start()
dishes = ['salad' ,'soup', 'bread' ,' entree']
washer(dishes,dish_queue)
dish_queue.join()
args = (dish_queue,))
, which seems to be correct, an error will be raised?
Answer the question
In order to leave comments, you need to log in
(dish_queue,) is a one element tuple and
(dish_queue) is the same as dish_queue
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question