2

Disclaimer: I'm extremely new at Python programming so I could be doing things very wrong here

All I want to do is run a git command from an open file. Here is the call that I am making

subprocess.Popen( 'git status', cwd = os.path.dirname( path ), shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE )

and the error message I am receiving is this: /bin/sh: git: command not found

I have verified that it is pointing to the correct directory by doing a list of the files. Also if I open a file that is under subversion control and do an svn info command everything works perfectly. I'm at a total loss as to what I'm missing here.

asked Jan 30, 2011 at 19:11
3
  • 3
    Make sure git is in the PATH of the user the Python script is running as? Commented Jan 30, 2011 at 19:14
  • are you using svn or git ??? because you want to run in you subprocess git status and after you said that you did svn info !!! and i don't know if this may help but i think the error that you get mean that git is not installed in your system Commented Jan 30, 2011 at 19:16
  • as i specified its a different file under subversion control that the svn info command works on. i run both svn and git. and yes git is installed, thanks Commented Jan 30, 2011 at 19:17

1 Answer 1

3

As Amber said, do a 'which git' in a shell, it'll tell you where git is installed. Then call git with the full path, eq with /usr/bin/git :

subprocess.Popen( '/usr/bin/git status', cwd = os.path.dirname( path ), shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
answered Jan 30, 2011 at 19:28
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.