subprocess wait() waits forever, but os.system returns

grayaii grayaii at gmail.com
Wed May 7 17:04:30 EDT 2008


Awesome! That worked!
And your comment just led me down another exploration path on why the
following doesn't work:
---------------------
while(returncode is None):
	returncode = run.poll()
	time.sleep(1)

out = run.stdout.readlines()
err = run.stderr.readlines()
---------------------
Nowhere in the loop am I reading stdout or err.
I'm only reading it after the loop has finished, and when running the
exe, returncode is *always* None.
Now I have to figure out a way to read it within the loop without
blocking the read... on Windows...

Thinking out loud: Perhaps it would be better to put the subprocess
commands in a separate thread so if my process hangs, I can kill it
after a given time.  Various threads in this forum suggested that
method, so perhaps I should do it that way...



More information about the Python-list mailing list