我花了将近 30 多分钟的时间来尝试所有可能的不同。终于现在我筋疲力尽了。有人可以帮我解决这个报价问题吗
def remote_shell_func_execute():
with settings(host_string='user@XXX.yyy.com',warn_only=True):
process = run("subprocess.Popen(\["/root/test/shell_script_for_test.sh func2"\],shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)")
process.wait()
for line in process.stdout.readlines():
print(line)
当运行工厂时,我得到
fab remote_shell_func_execute
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/main.py",line 654, in main
docstring, callables, default = load_fabfile(fabfile)
File "/usr/local/lib/python2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/main.py",line 165, in load_fabfile
imported = importer(os.path.splitext(fabfile)[0])
File "/home/fabfile.py", line 18
process = run("subprocess.Popen(\["/root/test/shell_script_for_test.sh func2"\],shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)")
^
SyntaxError: invalid syntax