I need to get a path to the GIT on Max OS X 10.6 using Python 2.6.1 into script variables. I use this code for that:
r = subprocess.Popen(shlex.split("which git"), stdout=subprocess.PIPE)
print r.stdout.read()
but the problem is that output is empty (I tried stderr
too). It works fine with another commands such as pwd
or ls
.
Can anyone help me with that?
UPDATE: When I run which git
from Terminal it prints out path as expected. So, which
can find it.
UPDATE 2: I just created the bash script
#!/usr/bin/env bash
GP=`/usr/bin/which git`
PWD=`pwd`
echo "PATH IS: ${GP}"
echo "PWD IS: ${PWD}"
and output is
PATH IS:
PWD IS: /Users/user/tmp