简体   繁体   English

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

[英]Using Fabric in Python, trying to run tsch commands on remote bash server

Sorry if that Title is confusing. 抱歉,该标题令人困惑。 I am running a remote python script over the local network using 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).

THE PROBLEM is that the env.set has tsch commands such as setenv which, when run in the Bash shell, give errors. 问题在于env.set具有tsch命令(例如setenv),这些命令在Bash shell中运行时会出错。 Is there any way that I can write the above to incorporate tsch commands? 有什么办法可以编写上述内容以合并tsch命令?

Nevermind I solved it myself :) 没关系,我自己解决了问题:)

Setting in the top: 设置在顶部:

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

I got around this environment issue. 我解决了这个环境问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM