在Python中使用Fabric,尝试在远程bash服务器上运行tsch命令

时间:2015-06-30 11:09:36

标签: 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():
    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,当在Bash shell中运行时,会给出错误。有什么方法可以编写上面的内容来合并tsch命令吗?

1 个答案:

答案 0 :(得分:0)

没关系我自己解决了:)

设置在顶部:

env.shell = '/bin/rbash -l -c' 

我解决了这个环境问题。