Advanced Scripting: Access BUILD_DIR path

Hello,

I am trying to use advanced scripting to access the ELF file and I am having trouble finding any documentation on the env object.
Win10, Board robotdyn_blackpill_f303cc

I am trying to execute a subprocess inside of the build directory.

ret = subprocess.run([“CMD”], shell=True, capture_output=True, check=True, cwd = env.Get(“BUILD_DIR”))

Problem is, that the output of env.Get(“BUILD_DIR”) is “$PROJECT_BUILD_DIR\$PIOENV”, which obviously is not a valid path. How do I get the final path out of the env object without building it myself?

There is no documentation that I could find on the functions available with the env object.
So which function should be used to get the parsed, final path without doing it manually? And I would suggest to build a function-based doc for the env object to make such things easier to find.

BR

Have you tried env.subst for substitution?

Nope, because it is documented nowhere.
But env.subst(’$BUILD_DIR’) works the way I expect it.
Thanks for the hint.

PlatformIO is an extension of SCons, the API of that are more extensively documentated at: https://scons.org/doc/latest/HTML/scons-api/SCons/#SCons.Environment.Base.subst. Next to the Advanced Scripting docs it’s one of the primary sources of documentation and comes in handy often.

Okay, it seems that I have overlooked that section.
My bad.