alias doesn't affect python execution environment in bash

我与影子孤独终老i 提交于 2019-12-23 04:28:14

问题


I'm getting error while executing my shell script

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) prints,,,

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

batch_update_autobuilds.py source code (Where the error is coming from)

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.

Problem:

  • Somehow when I call the bash execution command commandline.communicate(), it calls the old abs which doesn't have --test option.

Possible Solution(need help):

  • I copied abs execution file to ~/local/bin and I want to force python execution to use the abs in ~/local/bin; alias didn't work in this case.

来源:https://stackoverflow.com/questions/56878854/alias-doesnt-affect-python-execution-environment-in-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!