在Python中使用Fabric,尝试在远程bash服务器上运行tsch命令
抱歉,这个标题让人困惑。我使用Fabric在本地网络上运行远程python脚本:在Python中使用Fabric,尝试在远程bash服务器上运行tsch命令,python,unix,fabric,Python,Unix,Fabric,抱歉,这个标题让人困惑。我使用Fabric在本地网络上运行远程python脚本: #Path to file being run env.source = 'c/yadda/yadda' env.file = 'run_tests.py' env.set = 'source ~USERNAME/ENVIRONMENT' #create the task of changing the directory and running the test file from there def link
#Path to file being run
env.source = 'c/yadda/yadda'
env.file = 'run_tests.py'
env.set = 'source ~USERNAME/ENVIRONMENT'
#create the task of changing the directory and running the test file from there
def link():
print('Connecting to remote computer and setting envirnoment...')
run ('%s' % env.set)
run ('cd %s && ./%s' % (env.source, env.file))
--- The env.set is used to bring the Python version up to a more recent version so that the file commands work (open with was causing problems).
问题是env.set有tsch命令,比如setenv,在bashshell中运行时会出现错误。有没有什么方法可以编写上面的代码来合并tsch命令?不管我自己怎么解决:) 在顶部设置:
env.shell = '/bin/rbash -l -c'
我绕过了这个环境问题。但我自己解决了:) 在顶部设置:
env.shell = '/bin/rbash -l -c'
我绕过了环境问题