title: Using Queue in python
body: <p>I'm trying to run the following in Eclipse (using PyDev) and I keep getting error : </p>
  
  <p><strong>q = queue.Queue(maxsize=0)
  NameError: global name 'queue' is not defined</strong></p>
  
  <p>I've checked the documentations and appears that is how its supposed to be placed. Am I missing something here? Is it how PyDev works? or missing something in the code? Thanks for all help.</p>
  
  <pre><code>from queue import *
  
  def worker():
      while True:
          item = q.get()
          do_work(item)
          q.task_done()
  
  def main():
  
      q = queue.Queue(maxsize=0)
      for i in range(num_worker_threads):
           t = Thread(target=worker)
           t.daemon = True
           t.start()
  
      for item in source():
          q.put(item)
  
      q.join()       # block until all tasks are done
  
  main()
  </code></pre>
  
  <p>Using: 
  Eclipse SDK</p>
  
  <p>Version: 3.8.1
  Build id: M20120914-1540</p>
  
  <p>and Python 3.3</p>