【问题标题】:Executing Python script from Phing从 Phing 执行 Python 脚本
【发布时间】:2013-12-29 03:25:45
【问题描述】:

我的 Phing 构建文件中有以下内容:

<target name="fixModifiedTime">
    <echo msg="Fixing file modified time" />
    <exec executable="python" >
        <arg value="c:\scm\scripts\git-restore-mtime.py" />
        <arg value="-v" />
    </exec>
</target>

这导致我的 Jenkins 输出出现以下错误:

[exec] Executing command: python c:\scm\scripts\git-restore-mtime.py -v 2>&1
[exec] 'python' is not recognized as an internal or external command,
[exec] operable program or batch file.

我能够从 Jenkins 工作区目录执行相同的命令,并且它运行良好。 Python 目录已添加到我的环境变量中,并且脚本具有正确的权限。

我也尝试将脚本添加到我的存储库并在构建环境中运行它,但出现了同样的错误。

有什么想法吗?

【问题讨论】:

    标签: jenkins phing


    【解决方案1】:

    我建议如下:

    • 尝试在您的 Jenkins 中创建 Windows 批处理构建步骤并将命令放入其中。看看它是否运行
    • 很明显,您的 Jenkins 环境与您的控制台不同。看看 Jenkins 中缺少什么
    • 在 Jenkins 配置中添加 python 主目录和路径

    希望对你有帮助

    【讨论】:

    • 谢谢!我必须在 Jenkins 中设置 Python 路径,它现在可以完美运行。
    猜你喜欢
    • 1970-01-01
    • 2015-10-26
    • 2023-03-15
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多