0

I tried running the myview command and it ran successfully, but I am stuck after this step.

I have to choose from a list of views and have to pass in a number, for example say <1>,<2>..<10>. But when I execute the script it shows me option on the terminal window instead. Which command should I be using? Because after this I have to run a bunch of other commands as well and basically have to execute them in a particular order. So say cmd should wait for cmd to finish. Thanks in advance for the help.

This is what I have so far.

#! /usr/bin/python
import sys
from subprocess import call
for arg in sys.argv:
    print arg
call(["myview"])
4

2 回答 2

0

查看subprocess 的文档。我认为您需要的 API 调用是check_call.

于 2013-01-18T21:36:26.783 回答
0

来自pydoc subprocess

try:
    retcode = call("mycmd" + " myarg", shell=True)
    if retcode < 0:
        print >>sys.stderr, "Child was terminated by signal", -retcode
    else:
        print >>sys.stderr, "Child returned", retcode
except OSError, e:
    print >>sys.stderr, "Execution failed:", e
于 2013-01-18T21:37:58.980 回答