Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python运行的bash脚本运行bash命令时出现问题_Python_Eclipse_Bash - Fatal编程技术网

从Python运行的bash脚本运行bash命令时出现问题

从Python运行的bash脚本运行bash命令时出现问题,python,eclipse,bash,Python,Eclipse,Bash,我正在运行Python中的bash脚本。我的IDE是带有PyDev的Eclipse。我安装了一个软件,它有一个bash命令bull2flux,我想在bash脚本中运行它bull2flux通常是这样运行的: bull2flux someFile > outFile source path/to/software/bin/init.sh /dev/null 问题是,当直接在终端中调用它时,它可以正常工作,但在从python脚本运行它时则不行。我得到错误bull2flux:command n

我正在运行Python中的bash脚本。我的IDE是带有PyDev的Eclipse。我安装了一个软件,它有一个bash命令
bull2flux
,我想在bash脚本中运行它
bull2flux
通常是这样运行的:

bull2flux someFile > outFile
source path/to/software/bin/init.sh /dev/null
问题是,当直接在终端中调用它时,它可以正常工作,但在从python脚本运行它时则不行。我得到错误
bull2flux:command not found
。我曾尝试从终端运行我的软件的编译版本,但出现了相同的错误。这是Eclipse的问题吗?我必须以某种方式获取命令的来源吗
bull2flux
源于my
.bashrc
文件,如下所示:

bull2flux someFile > outFile
source path/to/software/bin/init.sh /dev/null
其他信息:这是我在bash脚本中运行它的方式:

for file in ${folder_bml_files}/*
do
    #Other stuff here
    bulledFile="bulltmp"
    bull2flux ${file} > ${bulledFile}
    #Other stuff here
done

我假设在执行脚本时bull2flux可执行文件不在路径中。在调用脚本之前,请尝试使用其完整路径或更新path变量

编辑:如果bull2flux只是一个shell函数(不是可执行文件),则可能必须从脚本中获取定义shell脚本的源代码。尝试添加行

源路径/to/software/bin/init.sh/dev/null


从.bashrc到您自己的shell脚本。

尝试使用脚本/程序的完整路径调用。如果所有用户都将二进制文件放在同一位置,则这可能会起作用。我知道这个特定的软件(以及二进制文件)已经为不同的用户安装在不同的位置,因此在这种情况下,最好在
.bashrc
文件中找到它的源代码。将二进制文件添加到PATH变量可以很好地工作。似乎
源路径/to/software/bin/init.sh/dev/null
做了一些与此不同的事情,尽管它也设置了
bull2flux
,以便在终端中使用。谢谢你给我指出正确的方向。