title: Python error : AttributeError: 'module' object has no attribute 'heappush'
body: <p>I am trying some simple programs which involve multiprocessing features in Python. </p>
  
  <h2>The code is given below:</h2>
  
  <pre><code>from multiprocessing import Process, Queue
  
  def print_square(i):
    print i*i
  
  if __name__ == '__main__':
    output = Queue()
    processes = [Process(target=print_square,args=(i,)) for i in range(5)]
  
    for p in processes:
      p.start()
  
    for p in processes:
      p.join()
  </code></pre>
  
  <hr>
  
  <p>However, this gives an error message <code>AttributeError: 'module' object has no attribute 'heappush'.</code> The complete output upon executing the script is given below:</p>
  
  <pre>
  Traceback (most recent call last):
    File "parallel_3.py", line 15, in 
      output = Queue()
    File "C:\Users\abc\AppData\Local\Continuum\Anaconda2\lib\multi
  processing\__init__.py", line 217, in Queue
      from multiprocessing.queues import Queue
    File "C:\Users\abc\AppData\Local\Continuum\Anaconda2\lib\multi
  processing\queues.py", line 45, in 
      from Queue import Empty, Full
    File "C:\Users\abc\AppData\Local\Continuum\Anaconda2\lib\Queue
  .py", line 212, in 
      class PriorityQueue(Queue):
    File "C:\Users\abc\AppData\Local\Continuum\Anaconda2\lib\Queue
  .py", line 224, in PriorityQueue
      def _put(self, item, heappush=heapq.heappush):
  AttributeError: 'module' object has no attribute 'heappush'
  </pre>
  
  <p>The code compiles fine if the output=Queue() statement is commented. 
  What could be possibly causing this error ?</p>