Python error : AttributeError: 'module' object has no attribute 'heappush' -


i trying simple programs involve multiprocessing features in python.

the code given below:

from multiprocessing import process, queue  def print_square(i):   print i*i  if __name__ == '__main__':   output = queue()   processes = [process(target=print_square,args=(i,)) in range(5)]    p in processes:     p.start()    p in processes:     p.join() 

however, gives error message attributeerror: 'module' object has no attribute 'heappush'. complete output upon executing script given below:

 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     multiprocessing.queues import queue   file "c:\users\abc\appdata\local\continuum\anaconda2\lib\multi processing\queues.py", line 45, in      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' 

the code compiles fine if output=queue() statement commented. possibly causing error ?


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -