I'm trying to use a multithreading queue and a multiprocessing queue at the same time. The threading queue will be used by 20 threads to retrieve many web pages. I then want to put the pages into a multiprocess queue so that 4 process workers can crunch the data. Below is my basic structure. My issue is that, the work queue, gives an error saying Queue is not iterable. I think the multithreading queue is overwriting the multiprocess queue but I really don't know what's wrong.
ticker_queue = Queue()
work_queue = Queue()
tickers = get_tickers()
for i in tickers:
ticker_queue.put(i)
for i in range(20):
t = Thread(target=network_worker, args = (ticker_queue, work_queue)).start()
for i in range(4):
p = Process(target = worker, args = (work_queue)).start()
Here is the traceback
Traceback (most recent call last):
File "OneDrive\Python\andys.py", line 108, in <module>
p = Process(target = worker, args = (work_queue)).start()
File "C:\Python27\lib\multiprocessing\process.py", line 104, in __init__
self._args = tuple(args)
TypeError: 'Queue' object is not iterable
p = Process(target = worker, args = (work_queue,)).start()