Unable to create new project in Core 5.1.0 (SCons Error message)

Looks like a problem in the new SCons.

PIO Core Call Error: "The current working directory C:\Users\<user>\Documents\PlatformIO\Projects\ESP32 CAM will be used for the project.

The next files/directories have been created in C:\Users\<user>\Documents\PlatformIO\Projects\ESP32 CAM
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File


Error: Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------
C:\Users\<user>\.platformio\python3\python.exe: can't open file 'C:\Users\<user>\.platformio\packages\tool-scons\scons.py': [Errno 2] No such file or directory
========================== [FAILED] Took 0.10 seconds =========================="

Can you remove the 'C:\Users\<user>\.platformio\packages\tool-scons\ folder and retry?

Worked great, thank you!

I tried the solution (delete tools-scons folder), but it was re-downloaded when I clicked Build.
I have rolled back to 5.0.0 and got the same problem. The 4.x.x releases are all the same, too, and rolling back to 3.5.0 is the same.

I have previously had success with this program, so I’m a bit confused as to why I’m getting this error now. (I am not experienced enough to understand the error messages.)

The board being used is an ESP-WROOM-32.

TypeError: Tried to lookup RootDir '\\' as a File.:
  File "C:\Users\dax\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 188:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\dax\.platformio\platforms\espressif32\builder\main.py", line 283:
    target_elf = env.BuildProgram()
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\dax\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProgramDeps()
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\dax\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 119:
    env.ProcessFlags(env.get("BUILD_FLAGS"))
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\dax\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 219:
    env.Append(**env.ParseFlagsExtended(flags))
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\dax\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 182:
    for key, value in env.ParseFlags(str(raw)).items():
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 815:
    do_parse(arg)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Environment.py", line 733:
    dict['LIBS'].append(self.fs.File(arg))
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Node\FS.py", line 1429:
    return self._lookup(name, directory, File, create)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Node\FS.py", line 1408:
    return root._lookup_abs(p, fsclass, create)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Node\FS.py", line 2441:
    result.must_be_same(klass)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Node\FS.py", line 2400:
    Base.must_be_same(self, klass)
  File "C:\Users\dax\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Node\FS.py", line 619:
    raise TypeError("Tried to lookup %s '%s' as a %s." %\
  1. Please ensure that you use the latest VSCode + PlatformIO IDE extension
  2. Remove C:\Users\dax\.platformio folder
  3. Open VSCode, wait a few seconds/minutes when the project will be invited and all packages will be installed.
  4. Build project.

Does it work now?

Thanks so much for the support, Ivan. Unfortunately following these steps didn’t work for me, even after restarting VSC.
These are the errors:

According to PIO, Espressif 32 platform is installed:

Here’s the list of installed Extensions:

I can confirm that my C:\Users\dax.platformio\packages directory is completely empty and, actually, the PIO Home tab just says “Loading…” permanently./

I uninstalled PIO, restarted VSC and still no joy with PIO, despite saying it’s installed.

Do you use any espionage software? dr.web, kaspersky, or another antivirus?

Yes, ESET NOD32. It’s pretty solid, never had issues with it, but I can try disabling for 5 mins. Should I uninstall/install anything?

I also use Nord VPN.

I temporarily disabled ESET and when I opened VSC, I saw that MS C/C++ Extension started downloading. After that, I only have one error in the Output panel. The odd thing is that it looks like it’s referring to an old version of something, perhaps? Look carefully at the paths, they are similar, but different:

This is because you have an old pre-generated configuration for VSCode. Once downloading is finished, PlatformIO will reconfigure the project.

P.S: The espionage software is hell, especially when it was developed in russia, such as dr.web, kaspersky.

I have left VSC open for a long time and still get this error. It seems like it’s not being automatically removed. Any thoughts on what I can do next?

If you reopen VSCode, do you see a spinner ( :gear: ) with project index rebuilding on the bottom status bar?

Not that icon, but yes, there is a spinner that appears for a second or two at startup.