I am trying to execute a simple git command using following python script.
#!/usr/bin/python
import commands
import subprocess
import os
import sys
pr = subprocess.Popen( "/usr/bin/git log" , cwd = os.path.dirname( '/ext/home/rakesh.kumar/workspace/myproject' ), shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
(out, error) = pr.communicate()
print "Error : " + str(error)
print "out : " + str(out)
but I am getting the following error even though I am running the python script in the same directory where git reposetory is.
Error : fatal: Not a git repository (or any of the parent directories): .git
I suspected the git might got correputed, but git files are fine and git commands work if I execute on normal command prompt.
I tried to search on net but couldn't get useful information. Please help it will be greatly appreciated.