Compiler failing when trying to use variable interpolation

Compiler suddenly throwing a “argument of type ‘NoneType’ is not iterable” on line 0 of platformio.ini, when using the following variable interpolation syntax (previously compiling fine before today)

[env]
platform = espressif8266
framework = arduino
board = esp12e

[env:Lollypops]
build_flags = -D SOMEFLAG
  !echo "-D FIRMWARE_VERSION="${FIRMWARE_VERSION}

See this documentation
https://docs.platformio.org/en/latest/projectconf/interpolation.html

This should be

upload_speed = 921600
1 Like

Thanks for your reply. Changed that, deleted .platformio cache directory, but still happening.

Okay found what’s happening. It’s actually due to using this syntax to output build flags:

[env:Lollypops]
build_flags =
!echo “-D FIRMWARE_VERSION=”${FIRMWARE_VERSION}

This used to work?

Looks like environment variables now need to be prefixed with sysenv ie

[env:Lollypops]
build_flags = 
	!echo "-D FIRMWARE_VERSION="${sysenv.FIRMWARE_VERSION}

A nicer error msg please, powers that be!