what's wrong with my code using subprocess?

Tim Lesher tlesher at gmail.com
Sun Jul 24 22:36:20 EDT 2005


I see the same behavior as you do.  On Windows, the wait() isn't
hanging--what's happening is that the subprocess just never receives
anything.

I don't quite understand why, but it works fine when I change the "if"
clause in receiver.py to this:

    if count >= 1000:
        p.communicate('exit')
        p.wait()
        break

Note the final break: if this isn't here, the next for iteration raises
an exception, as p.stdout has been closed by p.communicate.




More information about the Python-list mailing list