PlatformIO Community

Is there a simple example running a simple python script pre-build?

I need to run a script before each build. It is a script to insert an html file into a c++ source file. I don’t know python but I can learn it. An example program to do simple file operations would be great.

I looked at the docs but all I see if gobbledegook to my simple mind. There is all sorts of stuff about environment variables and I don’t understand why it is needed. Can’t a simple python script run that is specified in platformio.ini?

Never mind. I tried just ignoring the instructions and writing a simple script with no env vars. It works. The fact that you can write this type of script should be documented somewhere. Here it is for any lurkers …

index1 = open("index1.txt", 'r')
html   = open("index.html", 'r')
index2 = open("index2.txt", 'r')
indexh = open("include/index.h", 'w')