I was just writing to read a file using popen and wanted to use queue along
with it.
I have below code but it is giving this error:
AttributeError: Queue instance has no attribute 'taskdone'

import threading
from Queue import Queue

def worker(q):
    while True:
      dataset = q.get()
      print("q is taken out")
      q.taskdone()

def create_data(q):
    print("Inside create data")
    output = [1, 2, 3]
    for i in output:
      print("Inside", i)
      print("queue is put")
      q.put(i)

if __name__ == '__main__':
    q = Queue()
    t = threading.Thread(target=worker, args=(q,))
    t.daemon = True
    t.start()
    create_data(q)
    q.join()
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to