.ini files error- "No section: 'env'

There are some things I’m doing wrong because I haven’t learned the right thing yet, and there are a lot of PC and Windows issues complicating my study of complicated microprocessor stuff.

Here’s my .ini file:

; PlatformIO Project Configuration File
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

platform = espressif32
board = esp32doit-devkit-v1
framework = espidf
lib_extra_dirs = ${env.HOMEDRIVE}${env.HOMEPATH}\Documents\Arduino\libraries
lib_deps =

This is the error:
Can not remove temporary directory C:\Users\joema\Documents\PlatformIO\Projects\Sunday_ExploreEmbedded_Hello_DOIT\.pio\build. Please remove it manually to avoid build issues
Error: Invalid ‘C:\Users\joema\Documents\PlatformIO\Projects\Sunday_ExploreEmbedded_Hello_DOIT\platformio.ini’ (project configuration file): ‘No section: ‘env’’
The terminal process “C:\Users\joema.platformio\penv\Scripts\platformio.exe ‘run’” terminated with exit code: 1.

The only changes I’ve made are the two ‘lib’ lines. This is a native PlatformIO .ini file, and it isn’t working.

How did I contribute to this error? Computers, programming languages were all working fine when i got here. How did I mess it up?

Why is this a ‘temporary directory?’ I can’t fix it, because I don’t know what this is.

It is considered a ‘temporary directory’ because (just like with the Arduino IDE), it’s the directory where the binary bits for the compile are stored when you hit the compile/build button. Which allows subsequent builds to be a lot faster, because this stuff has been cached. You can see this folder if use the ‘Reveal in File Explorer’ option in VSCode to quickly navigate to a project folder - just right click on the folder in the file browser panel…


However, this is the actual error. As I think you’ve realised since now… it should be ${sysenv., not ${env. … hence the ‘No section: ‘env’ error. ` There’s no need to delete the folder mentioned on the prior line, just make the correction and try compiling/building again.

Bonus tip - if you’re not specifying any libraries to use, and instead are using lib_extra_dirs to point to the Arduino IDE libraries folder, you don’t need the lib_deps line, as you’re not telling PlatformIO it needs to install / maintain any libraries.

I’m scrambling and creating a pile of garbage while I try to find my way around several issues.

I do want my cache of Arduino libraries accessible to PlatformIO. I deleted that Sysenv line, because I thought it could be contributing to my confusions.

Should I leave it in?
Then I wouldn’t have any libraries to add individually, in principle.

Yes, put it back in (corrected), and remove the empty lib_deps line, since you’re not using PlatformIOs library management. If you don’t put the lib_extra_dirs line ine… how does PlatformIO know where you Arduino libraries are? :wink:

lib_extra_dirs = ${sysenv.HOMEDRIVE}${sysenv.HOMEPATH}\Documents\Arduino\libraries

Thank you. I appreciate your help.