On Tue, Mar 22, 2005 at 07:16:11AM -0700, Earl Eiland wrote:
> I've been having trouble with a program hanging when using the
> subprocess modules "wait()" method.  Replacing it with with a loop that
> used "poll()" solved the problem.

Please include an example, and more information about what platforn you're using
This simple program worked fine for me on Linux with Python 2.4:
#------------------------------------------------------------------------
import subprocess, time

s = subprocess.Popen(['sleep', '2'])
while 1:
    time.sleep(.1)
    if s.poll() is not None: break
print "polling wait done", s.returncode

s = subprocess.Popen(['sleep', '2'])
s.wait()
print "blocking wait done", s.returncode
#------------------------------------------------------------------------

Jeff

Attachment: pgpq6ATZLp4Bp.pgp
Description: PGP signature

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

Reply via email to