Was wondering if someone could point out what the stupid thing I'm doing
wrong is:


{{{
import os, time
def run_multi_proc():
    server_send, logger_recieve = os.pipe()
    pid = os.fork()
    if pid == 0:
        # we are the logger
        #os.close(server_send)
        logger_recieve = os.fdopen(logger_recieve)
        time.sleep(20)
    else:
        # we are the server
        #os.close(logger_recieve)
        server_send = os.fdopen(server_send,"w")
        time.sleep(3)
        os.kill(pid,signal.SIGTERM)

if __name__ == "__main__":
    run_multi_proc()
}}}


> python test.py

Traceback (most recent call last):
  File "test.py", line 20, in <module>
    run_multi_proc()
  File "test.py", line 9, in run_multi_proc
    logger_recieve = os.fdopen(logger_recieve)
OSError: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "test.py", line 20, in <module>
    run_multi_proc()
  File "test.py", line 15, in run_multi_proc
    server_send = os.fdopen(server_send,"w")
OSError: [Errno 22] Invalid argument


really confused about why this isn't working - running on Linux with
python 2.5.2

Tim W

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to