AttributeError while using queuing Threads
In python versions prior to 3.0, we use the queue to manage the sequencing of the various threads created for some process, which need to be executed in parallel instances. Sample Code for using queue with threads. Using the same code with python 3.10 yields error.
import queue import threading import time class myThread (threading.Thread): def __init__(self, threadNo): threading.Thread.__init__(self) self.threadNo = threadNo def run(self): print ("Starting " + self.threadNo) funcname(self.threadNo) threadList = ["Thread-1", "Thread-2", "Thread-3"] workQueue = queue.queue(10) # Wait for all threads to complete for t in threads: t.join() print ("Exiting Main Thread")
AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_6756/3163176872.py in <module> 30 nameList = ["One", "Two", "Three", "Four", "Five"] 31 queueLock = threading.Lock() ---> 32 workQueue = queue.queue(10) 33 threads =  34 threadID = 1 AttributeError: module 'queue' has no attribute 'queue'