I am invoking cmd from Python like this:
subpocess.Popen(['coffee'], shell=True)
which I belive is translated to:
/bin/sh -c "coffee"
From docs I have read that in non-interactive mode files like /etc/profile, /etc/bash.bashrc are not read and default $PATH is used (init $PATH). Am I right? Is there the only way to add coffee to the $PATH is to copy it to /usr/local/bin?
No, the shell will inherit the
PATHfrom the Python interpreter, i.e. it will beos.getenv('PATH'). Also, you can set the path within the command:though I’d really advise you to either use the full path to
coffee, or set thePATHbefore executing your Python program.