Hi, Code: import os, time def child(pipeout): zzz = 0 while True: time.sleep(zzz) msg = ('Spam %03d' % zzz).encode() os.write(pipeout, msg) zzz = (zzz+1) % 5 def parent(): pipein, pipeout = os.pipe() if os.fork() == 0: child(pipeout) else: while True: line = os.read(pipein, 32) print('Parent %d got [%s] at %s' % (os.getpid(), line, time.time())) parent()
Output: Traceback (most recent call last): File "C:/Python34/pipe1.py", line 17, in <module> parent() File "C:/Python34/pipe1.py", line 11, in parent if os.fork() == 0: AttributeError: 'module' object has no attribute 'fork' Why does this error appear? Module os provides fork(). How to solve this problem? Kindly help. -- https://mail.python.org/mailman/listinfo/python-list