QtCreator拒绝执行自定义python程序作为构建步骤命令

Qt Creator refuses to execute Custom python program as a build step command

本文关键字:构建 命令 拒绝执行 自定义 python 程序 QtCreator      更新时间:2023-10-16

我正在编写一个共享库,为了更新/usr/include目录中的头文件,我编写了一个python程序来比较并保持/usr/include目录中源目录的头文件是最新的,希望在每次构建中将它们与测试可执行文件链接时,头文件本身能够自动完成。

问题是Qt Creator无法执行python程序。我的设置如下:

Command : 'python'
Working Directory : '/path/to/python/file'
Args    : 'PythonFile.py'

是,选中启用自定义流程步骤框。

我的输出类似于以下内容:

Could not start process "python " PythonFile.py

当然,如果有另一种更简单的方法来解决这个标题问题(包括更新自动完成的能力),我完全洗耳恭听。

编辑

我还应该说,我已经通过CLI执行了该程序,它运行良好。

更新

根据斯拉瓦的建议更新命令,我得到了以下输出:

Program is beginning
Traceback (most recent call last):
  File "UpdateHeaders.py", line 59, in <module>
    PROJECT_ROOT      = environ['ATLAS_PROJ_ROOT']
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'ATLAS_PROJ_ROOT'
13:08:35: The process "/usr/bin/env" exited with code 1.

然而,如果我通过CLI运行它,我会得到:

Program is beginning
Updating include directory on a UNIX based system, copying files from /home/amsterdam/Programming/atlas/Engine/AtlasEngine/ to /usr/include/atlas/Engine/
Found a source count of 5;
Found a dest count of 0
No headers have been copied to "/usr/include/atlas/Engine/", yet; copying now from "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/" 
Iterating through ['AtlasEngine.pro', 'GameObject.hpp', 'AtlasEngine_global.h', 'Type_Config.hpp', 'Rectangle.hpp', 'AtlasEngine.pro.user', 'Engine.hpp', 'Engine.cpp']
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/GameObject.hpp" to "/usr/include/atlas/Engine/GameObject.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/AtlasEngine_global.h" to "/usr/include/atlas/Engine/AtlasEngine_global.h"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Type_Config.hpp" to "/usr/include/atlas/Engine/Type_Config.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Rectangle.hpp" to "/usr/include/atlas/Engine/Rectangle.hpp"
Copying "/home/amsterdam/Programming/atlas/Engine/AtlasEngine/Engine.hpp" to "/usr/include/atlas/Engine/Engine.hpp"

如图所示,除非通过Qt Creator运行,否则一切都很好,没有任何错误。有什么建议吗?

Command : '/usr/bin/env'
Working Directory : '/path/to/python/file'
Args : 'python PythonFile.py'


Command : '/usr/bin/env'
Args : 'python /path/to/python/file/PythonFile.py'