在git shell中python脚本的路径问题
我正在尝试使用一个脚本,链接在这里:https://github.com/charleso/git-cc。你可以看到麻烦的部分在这里:common.py。
我的操作系统是Windows 7。我按照说明在git shell中使用这个脚本。
我执行了:
gitcc init /c/clearcase/myview/vob/
或者
gitcc init c:/clearcase/myview/vob/
结果失败了,出现了:
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, **args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 57, in popen
pipe = Popen(cmd, cwd=cwd, stdout=PIPE, stderr=PIPE, env=env)
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
如果我打开DEBUG模式,它告诉我正在尝试运行“git branch”。我检查过os.environ,里面的路径是正确的,并且“git”在这个路径中。即使在“env”变量中使用os.environ也没有任何改变。从shell中执行“git”和“git branch”都没有问题。我到底哪里做错了呢?
1 个回答
1
好的,从cygwin的bash命令行运行这个程序解决了问题,运行得很顺利。我应该早就想到git bash(mingw系统)和cygwin不太兼容。