I want to replace os.system command with subprocess.call command in python.
(我想用python中的subprocess.call命令替换os.system命令。)
D = "Some string value received at run time" P = "Some string value received at run time"
(D =“在运行时收到一些字符串值” P =“在运行时收到一些字符串值”)
Cmd = D + P + "| sudo /bin/tar -xvpPf - 1>> " + LoggerFile untarCmd = os.WEXITSTATUS(os.system(Cmd))
(Cmd = D + P +“ | sudo / bin / tar -xvpPf-1 >>” + LoggerFile untarCmd = os.WEXITSTATUS(os.system(Cmd)))
Now I want to replace above os.system with subprocess.call command.
(现在我想用subprocess.call命令替换上面的os.system。)
pCmd = subprocess.Popen(shlex.split(D + P),shell=False,stdout=subprocess.PIPE) untarCmd = subprocess.call(shlex.split("untarCmd"),shell=False,stdin=pCmd.stdout)
(pCmd = subprocess.Popen(shlex.split(D + P),shell = False,stdout = subprocess.PIPE)untarCmd = subprocess.call(shlex.split(“ untarCmd”),shell = False,stdin = pCmd.stdout))
But receiving error OSError: [Errno 2] No such file or directory error writing output file
(但是收到错误OSError:[Errno 2]写入输出文件时没有此类文件或目录错误)
ask by james translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…