【问题标题】:builtins.OSError: 'git' has an invalid shebang line: 'git' is not a valid executablebuiltins.OSError:'git' 的 shebang 行无效:'git' 不是有效的可执行文件
【发布时间】:2019-03-01 03:58:36
【问题描述】:

我是 buildbot 的新手。我根据 Buildbot 1.5.0 文档的行会设置了 master.cfg。 我已经通过Tutorial的公会设置了master。 master.cfg就是master.cfg.sample。可以强制构建,结果是成功。但是在twistd.log 中有一个错误。

builtins.OSError: 'git' has an invalid shebang line: 'git' is not a valid executable

详情请看下文。

谁能告诉我发生了什么?我确定 git 安装得很好,因为它可以强制构建成功。

It can be forced to build successfully.

2019-03-01 11:45:32+0800 [-] while polling for changes
Traceback (most recent call last):
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\buildbot\changes\gitpoller.py", line 410, in _dovccmd
    stdout = yield self._dovccmdImpl(command, args, path)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\buildbot\changes\gitpoller.py", line 192, in poll
    yield self._checkGitFeatures()
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\buildbot\changes\gitpoller.py", line 122, in _checkGitFeatures
    stdout = yield self._dovccmd('--version', [])
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\buildbot\changes\gitpoller.py", line 410, in _dovccmd
    stdout = yield self._dovccmdImpl(command, args, path)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\buildbot\changes\gitpoller.py", line 434, in _dovccmdImpl
    full_args, path=path, env=full_env)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\utils.py", line 174, in getProcessOutputAndValue
    reactor)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\utils.py", line 28, in _callProtocolWithDeferred
    reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\posixbase.py", line 353, in spawnProcess
    return Process(self, processProtocol, executable, args, env, path)
  File "c:\buildbot\tmp\bb-master\sandbox\lib\site-packages\twisted\internet\_dumbwin32proc.py", line 240, in __init__
    command, command))
builtins.OSError: 'git' has an invalid shebang line: 'git' is not a valid executable

【问题讨论】:

  • 请将您的输出添加为文本,不要截图。您的错误表明名为 git 的文件中有错误的 shebang。可以加吗?前几行就足够了。

标签: python git continuous-integration buildbot


【解决方案1】:

你可以看到产生error message here的代码类型:

            # look for a shebang line.  Insert the original 'command'
            # (actually a script) into the new arguments list.
            sheb = _findShebang(command)
            if sheb is None:
                raise OSError(
                    "%r is neither a Windows executable, "
                    "nor a script with a shebang line" % command)
            else:
                args = list(args)
                args.insert(0, command)
                cmdline = quoteArguments(args)
                origcmd = command
                command = sheb
                try:
                    # Let's try again.
                    doCreate()
                except pywintypes.error, pwte2:
                    # d'oh, failed again!
                    if _invalidWin32App(pwte2):
                        raise OSError(
                            "%r has an invalid shebang line: "
                            "%r is not a valid executable" % (
                                origcmd, sheb))
                    raise OSError(pwte2)

显然,当执行git(从shebang 中提取)时,进程在路径中找不到git,并且失败。

使用/c/path/to/git.exe 作为shebang 可能更有效率。

【讨论】:

    猜你喜欢
    • 2016-02-29
    • 2015-12-16
    • 2019-03-28
    • 2016-12-20
    • 2021-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-18
    相关资源
    最近更新 更多