别名不会影响bash中的python执行环境

时间:2019-07-03 22:58:57

标签: python bash node-modules

执行我的shell脚本时出现错误

alias abs='~/local/bin/abs'
echo $(which abs)
source /home/rundeck/.bashrc # included alias abs as well. I'm just sourcing it twice.
python batch_update_autobuilds.py <- I'm getting an error here

($which abs)打印,

alias abs='~/local/bin/abs'
        ~/local/bin/abs

batch_update_autobuilds.py源代码(错误来自何处)

abscommand = "abs update --test" // --test tag has been recently updated. 
commandline = subprocess.Popen((abscommand))
output, error = commandline.communicate()
if error: <- error got caught here. //So it says no option available for --test.

问题:

  • 以某种方式,当我调用bash执行命令commandline.communicate()时,它调用了没有abs选项的旧--test

可能的解决方案(需要帮助):

  • 我将abs执行文件复制到~/local/bin,并且我想强制python执行使用abs中的~/local/bin;在这种情况下,别名无效。

0 个答案:

没有答案