Pre-build steps not executing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pre-build steps not executing

Jump to solution
238 Views
Farnam
Contributor II

I have a python script to aggregative GIT info like commit and branch name, in the root directory of my project.
I want the script to execute as a pre-build step.

I go to Properties -> Settings -> Build Steps ... and enter the command to run the script with the `Release_FLASH` config"

cd.. python sample.py

However, the python script does not execute.
I tried creating a .bat file with the same execution instructions, but still no luck.

What am I missing here? Is there a flag I need to set somewhere? 

0 Kudos
1 Solution
203 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

If the file (.py or .bat) is not included inside the project and by project properties, try with the whole path to the file so it can be recognized, as such:

python "C:\User\user\Downloads\hello_world.py"

Julin_AragnM_0-1712943405922.png

I did a simple test with a hello world and it printed before finishing building:

Julin_AragnM_1-1712943413548.png

If this still does not work, try to add

cmd.exe

in front of your command line, so it launches the windows shell/command prompt.

Best regards,
Julián

View solution in original post

0 Kudos
3 Replies
204 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

If the file (.py or .bat) is not included inside the project and by project properties, try with the whole path to the file so it can be recognized, as such:

python "C:\User\user\Downloads\hello_world.py"

Julin_AragnM_0-1712943405922.png

I did a simple test with a hello world and it printed before finishing building:

Julin_AragnM_1-1712943413548.png

If this still does not work, try to add

cmd.exe

in front of your command line, so it launches the windows shell/command prompt.

Best regards,
Julián

0 Kudos
160 Views
Farnam
Contributor II

Hi @Julián_AragónM ,

Thank you!!

This may well have worked, so I'll mark it as the accepted answer.
However, I ended up doing the following work-around.

  1. Go to Properties  Builders
  2. Create a new builder, click "New..."
  3. Double click program
  4. Name the new builder
  5. Enter the location of the script
  6. Enter the working directory of the script
  7. Under refresh
    1. Select "Refresh resources upon completion."
    2. Then select "The selected resource"
  8. Select "After a "Clean"" (Optional)
  9. Select "During manual builds" (Optional)
  10. Then click "OK"
  11. Now click on the new builder and press the "Up" key until it is at the top of the list
148 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Farnam,

Thank you for the workaround as well!

Best regards,
Julián

0 Kudos