How to get path to the installed GIT in Python?

Posted by Vladimir Prudnikov on Stack Overflow See other posts from Stack Overflow or by Vladimir Prudnikov
Published on 2010-03-12T18:49:35Z Indexed on 2010/03/12 18:57 UTC
Read the original article Hit count: 210

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?

© Stack Overflow or respective owner

Related posts about python

Related posts about subprocess