python - Does multiprocessing.Pipe have to be passed to subprocess through inheritance -


i understand multiprocessing.queue has passed subprocess through inheritance. however, when try passing pipe subprocess through message passing, following code, error got isn't saying "pipe can shared between processes through inheritance". instead fails @ q.get() , error says typeerror: required argument 'handle' (pos 1) not found. i'm wondering @ possible so? assuming pipes implemented using linux named pipes, matters name of pipe , states serialized , passed between processes right?

from multiprocessing import process, pipe, queue      def reader(q):   output_p = q.get()   msg = output_p.recv()   while msg not none:     msg = output_p.recv()      if __name__ == '__main__':     q = queue()     reader_p = process(target=reader, args=(q,))     reader_p.start()     # launch reader process      output_p, input_p = pipe(true)     q.put(output_p)      input_p.send('mymessage')     input_p.send(none)     reader_p.join() 

this bug has been fixed in python 3.

your code in python 3 works flawlessly.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -