First time here? Check out the FAQ!

zz's profile - activity

2019-03-07 08:54:44 -0500 received badge Student (source)
2019-03-07 08:54:34 -0500 marked best answer Why doesn't Queue work?

from multiprocessing import Process, Queue import os, time, random def write(q): print ('Process to write: %s' % os.getpid()) a=33 q.put(a) def read(q): # It seems that the function doesn't work print ('Process to read: %s' % os.getpid()) while True: value = q.get(True) print ('Get %s from queue.' % value)

if __name__=='__main__': 
    q = Queue() 
    pw = Process(target=write, args=(q,)) p
    r = Process(target=read, args=(q,)) 
    pw.start() 
    pr.start() 
    pw.join() 
    pr.terminate() 
    print ('done')

the output:

Process to write: 1880
done
2018-01-26 03:50:00 -0500 answered a question Why doesn't Queue work?

Later I run the code in Spyder,  in Pycharm ( latest edition ), The results are always the same.   the interpreter is Py

2018-01-25 07:41:00 -0500 asked a question Why doesn't Queue work?

Why doesn't Queue work? from multiprocessing import Process, Queueimport os, time, randomdef write(q): print ('Process t