Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am running a bash script from Python. My IDE is Eclipse with PyDev. I have installed a software that has a bash command bull2flux that I want to run inside my bash script. bull2flux is usually run like this:

bull2flux someFile > outFile

The problem is that this works fine when it is invoked directly in the terminal, but not when running it from my python script. I get the error bull2flux: command not found. I have tried running the compiled version of my software from the terminal, but the same error occurs. Is this a problem with Eclipse? Do I have to source the command somehow? bull2flux is sourced in my .bashrc file like this:

source path/to/software/bin/init.sh /dev/null

Additional info: This is how I run it in my bash script:

for file in ${folder_bml_files}/*
do
    #Other stuff here
    bulledFile="bulltmp"
    bull2flux ${file} > ${bulledFile}
    #Other stuff here
done
share|improve this question
1  
Try calling using the full path of the scripts/programs. –  Joachim Pileborg Feb 6 '13 at 9:00
    
This would probably work if the binary was placed in the same location for all users. I know that this particular software (and thus the binaries) has been installed in different locations for different users and thus it is better to source it in the .bashrc file in this case. –  Krøllebølle Feb 6 '13 at 9:49

1 Answer 1

up vote 0 down vote accepted

I assume that the bull2flux executable is not in the PATH while your script is being executed. Try either using its full path or updating the PATH variable before calling the script.

EDIT: If bull2flux is just a shell function (not an executable), you might have to source the defining shell script from your script. Try adding the line

source path/to/software/bin/init.sh /dev/null

from your .bashrc to your own shell script.

share|improve this answer
    
Adding the binary to the PATH variable works fine. It seems the source path/to/software/bin/init.sh /dev/null does something different than this even though it also sets up bull2flux for use in the terminal. Thanks for pointing me in the rigth direction. –  Krøllebølle Feb 6 '13 at 9:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.