Pre-Build batch commands

This forum is for all Flare issues not related to any of the other categories.
Post Reply
burki
Jr. Propeller Head
Posts: 3
Joined: Sun Oct 25, 2020 11:28 pm

Pre-Build batch commands

Post by burki »

Hello
I am trying to run a python script when generating a target, so I thought to use the "Pre-Build Event" to run a batch file.
I inserted this pre-build command:
C:/Users/[USER]/Documents/test_py0.bat

This is the batch file called "test_py.bat" that is called:

@echo TEST FLARE pre Build Batch
@echo off
python C:/Users/[USER]/Documents\flare_tgt_test_1.py
pause

But unfortunately, nothing happens before building the target. According to the build log, the pre build command is read and processed. But I expect that a command prompt window opens and shows the echo-text at least.

However, the "mkdir" command that is shown in the online help is executed when putting it into a batch file. So it seems there are some commands that are executed and some are not.
Tech support could not help me.
Does anybody have experience with this and can show me a way how to execute python scripts from Flare?

Thank you very much.
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: Pre-Build batch commands

Post by doloremipsum »

I have limited experience with build commands, but one major difficulty is that they cannot handle spaces in filepaths at all. So if the [USER] is "Firstname Lastname", that space is probably preventing Flare from finding the path to the batch file. Although if that's the case, I might expect to see an error in the build log :?

As a test, try running the same command but call the batch file and script from C:/Testing or something simple like that.

I have a worked example of my (eventually) successful post-build script here: viewtopic.php?f=12&t=31921
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
burki
Jr. Propeller Head
Posts: 3
Joined: Sun Oct 25, 2020 11:28 pm

Re: Pre-Build batch commands

Post by burki »

Thank you very much for your answer, but there are no spaces in the paths. Additioanlly, the build log shows that the pre build script was executed without any errors/issues.
It seems that opening a command line window does not work, also executing the python script call.
Post Reply