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