0
在python中我試圖執行fabfile,並從子進程輸出中得到下面的錯誤。我使用簡易安裝來安裝面料。如果我從命令行運行代碼,它就可以工作。從python不行去。我認爲我如何使用Popen命令存在問題?Python結構不能從python使用子進程執行
/bin/sh: 1: fab: not found
下面是我如何開始布蟒蛇:
cmd = """fab -H 111.111.111.111 aws_bootstrap initial_chef_run:aws_server.json,aws-test,development -w """
os.chdir(fab_path) #change to the dir where the fabfile is located
p = subprocess.Popen(cmd, shell=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE)
PS我加了下面的POPEN但得到下面的錯誤:
executable="/bin/bash"
/bin/bash: fab: command not found
在命令行中我得到下面這意味着終端可以找到晶圓廠。
fab
Fatal error: Couldn't find any fabfiles!
Remember that -f can be used to specify fabfile path, and use -h for help.
Aborting.
使用織物執行命令比通過popen調用fabfile更好。 – tobltobs 2014-12-05 17:49:28
我會嘗試刪除'stdout'參數 - 然後這個命令不應該立即執行(只有當你要做的事情就像調用'p.communicate()') – robjohncox 2014-12-05 17:50:36