git shell 中 python 脚本的路径问题

发布于 2024-12-28 03:02:10 字数 1090 浏览 1 评论 0原文

我正在尝试使用脚本 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

如果我打开调试,它告诉我它正在尝试运行“git分支”。我已验证 os.environ 包含正确的路径,并且“git”位于该路径中。在“env”变量中使用 os.environ 仍然没有任何区别。 “git”和“gitbranch”可以从 shell 中正常执行。我做错了什么?

I'm trying to use script https://github.com/charleso/git-cc. You can see the troublesome part there, it's in common.py.

Operating system is windows 7. Using git shell, as instructed in the readme.
Executing:

gitcc init /c/clearcase/myview/vob/

or

gitcc init c:/clearcase/myview/vob/

fails with:

  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

If I turn on DEBUG, it tells me it is trying to run "git branch". I have verified os.environ contains correct path and "git" is in that path. Using os.environ in the "env" variable still made no difference. "git" and "git branch" work fine executing from the shell. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2025-01-04 03:02:10

好的,从 cygwin bash shell 运行它解决了问题并且运行良好。我应该猜到 git bash(mingw 系统)与 cygwin 的配合不太好。

Ok, running it from cygwin bash shell resolved the issue and it run out fine. I should've maybe guessed git bash (mingw system) doesn't play that well with cygwin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文