This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Running Python Script as Build Command

I am trying to run a Python script as my build command: 

python ${ProjDirPath}/make_wrapper.py

From within my Python script, I call the make with the two arguments:

    make_command = f"make {JOBS} {FUNCTION}"
    subprocess.run(make_command, shell=True, cwd=os.getcwd())
I am getting the following errors when I do this:
"python C:\\xxx\\xxx\\xxx\\xxx\\make_wrapper.py" -j12 all
Cannot run program "python C:\xxx\xxx\xxx\xxx\make_wrapper.py": Launching failed

Error: Program "python C:\xxx\xxx\xxx\xxx\make_wrapper.py" not found in PATH

However, I have a post-build command that I use in the same fashion that runs without issue. This is the command for that:
python ${ProjDirPath}/post_build.py ${ProjName} Debug
Any thoughts would be appreciated.
  • To provide more background: I am trying to use a script type that works on both Windows and Linux. It works fine on Windows with a .bat substituted for the .py file.

    The issue seems to be that the IDE is treating "python" as the executable and the "make_wrapper.py" as an argument instead of executing the .py file using the Python interpreter. 

  • Got it working.

    Set the Build Command to just "python" under Builder Settings

    Under Behavior, select Use custom build arguments and then set Build arguments to "${ProjDirPath}/make_wrapper.py"

    and then for my Build (Incremental build) I set to "-j12 all", same thing for clean