It has been a while since using Platformio and projects that worked are failing. I have a post script to copy firmware to an ota update folder and VSCode was complaining about the print commands without brackets and I noticed it was set to my system Python 3.7.3 . I can correct the print problems but the first line Import(‘env’) does not work. Do I have to install a specific Platformio module into Python for this to work? Clicking on the python version text let me switch to ~.platformio\python27\python.exe interpreter, but it still will not Import.
What error does it throw? You’re not trying to execute this directly with a python interpeter yourself right, but let PIO execute it in terms of a
I’m not at the running stage, it is VSCode that is complaining about the errors, can I assume it will run correctly? I am used to working in Python in PyCharm where errors are errors.
Import() is SCons’ way of importing variables (https://github.com/SCons/scons/wiki/SConscript(), https://scons.org/doc/3.1.1/HTML/scons-user.html#idm3325). Maybe you have to execute in the right PyEnv (
OK I will blame that on VSCode auto complete or whatever. The code runs fine. did a build and the firmware was copied fine.
thanks for the super fast reply’s
It was the Python Linting extension it asked to install, that was throwing all the errors. disabled it and it is no longer bothered by the non Python code.
Just for completenes’ sake: The
Export()) functions are generated at runtime in the
__init__.py of the Scons.Script file: Here
Export() are implemented here: https://github.com/SCons/scons/blob/82579b2d0705067c63d1e01a1188a3dfb2ef4d90/src/engine/SCons/Script/SConscript.py#L518-L552
So I’m sure a python linter has a hard time in picking that, since it’s a runtime-defined variable. I don’t now if there’s a nice IDE way to program SCons Scripts, but that error is definitely ignorable.