Re: Why my process cannot terminate when Pipe Connection is closed

2016-06-22 Thread Lawrence D’Oliveiro
On Thursday, June 23, 2016 at 10:50:10 AM UTC+12, Ke Wang wrote: > Raises EOFError if there is nothing left to receive and the other end was > closed. Does the parent process have to close the sending end of the pipe as well? Otherwise the receiver never gets EOF as long as one process still has

Why my process cannot terminate when Pipe Connection is closed

2016-06-22 Thread Ke Wang
import multiprocessing as mp def send(conn): """send obj to pipe""" for i in range(10): conn.send(i) print("send:", i) conn.close() def transform(func, conn): """receive input from pipe, transform it""" try: while True: i = conn.recv()