*** missing SConscript file 'build.py'

Hi I’m currently using PlatformIO with my ESP32 project.

Here’s the project settings [common]

release_version = 0.0.5
debug_level = 3
extra_scripts = pre:build.py
platform = espressif32
monitor_speed = 115200
upload_speed = 921600
upload_protocol = esptool
build_flags_all = 
	; -mfix-esp32-psram-cache-issue
build_flags_mqtt = 
build_flags_basic = 

Up to a few days ago, everything was working fine, and the project was building. But from yesterday, I’ve been getting the following error:

*** missing SConscript file 'build.py'
File "C:\Users\*****\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 167, in <module>

I cannot find any posts about this error except for 1 and that didn’t help. I’ve tried to build the same project on 2 other computers, but both fail to build for the same exact reason, which makes me think it’s an issue with an update?
Is anyone else having this problem?

Any and all suggestions are greatly appreciated, thank you

The script you explicitly specified cannot be found.
Do you have this file in your project folder?

I don’t have it, but it was working without having the build.py in the src folder before.

I was trying to see what the error is, so I’ve looked for the build.py file in the .platformio directory, but there seems to be many of them. I’ve copied one over to the src folder and ran it, but still going to the same error.

On another note, I just erased the “pre:build.py” from the “extra_scripts” and things seem to be working fine. Any explanations on what this does is also welcome - just don’t want to overlook something that is critical and I find an error later

This file is a user-defined file that you (or the creator of the project) create in the root folder of the project (at the same level as the platformio.ini). Not in the ./src folder.
You can find more information here Pre & Post Actions — PlatformIO latest documentation

A “pre-script” executes user-defined actions before the build process starts and the actual firmware is built. For example, it can copy and rename files, set compiler flags and much more.
Without knowing the contents of the file, it is impossible to say exactly what it does.

1 Like

Referencing non-existing SCons scripts has been upgraded from warning to fatal error in an SCons base-framework update.


  • Calling SConscript() with a nonexistent file is now an error.
    Previously this succeeded - prior to SCons 3.0, silently; since 3.0, with
    a warning. Developers can still instruct such an SConscript() call not
    to fail by being explicit: pass keyword argument “must_exist=False”.
    The “–warn=missing-sconscript” commandline option is no longer available
    as the warning was part of the transitional phase.

This has been in the PIO Core since stable release 6.1.12 per commit, which was released on January 10th, 2024.

So the VSCode PlatformIO extensions likely updated your PIO core version to the latest (as it should), and with it that changed.

1 Like

Thank you for both of your explanations, considering that it runs while commenting out the pre:build.py and what max mentioned, it seems like it was something that wasn’t needed, but threw an error with the recent update to the PIO core. I understand a bit better now thank you!