Asychronous execution *with* return codes?

utabintarbo utabintarbo at gmail.com
Thu Oct 5 10:43:13 EDT 2006


MonkeeSage wrote:
> utabintarbo wrote:
> > pid = subprocess.Popen([app] + lstArgs).pid
>
> Check out the poll() method and the returncode attribute:
> http://docs.python.org/lib/node533.html
>

Thanks for the reply.

If I understand your meaning, I should do something like this (given I
wish to run an app against several arguments [my use case]):

for lstArgs in pileOflstArgs:
    uniqueProcessID = subprocess.Popen([app] + lstArgs)
    pid = uniqueProcessID.pid
    retcode = uniqueProcessID.poll()
    # increment uniqueProcessID
    ....

If so, how do I handle the poll() on long-running processes? Run a
bunch and then start a check loop? Am I asking too many questions?




More information about the Python-list mailing list