Failing to import a zephyr example on a Windows machine

Hello,

I’m new to PIO and was trying to launch the ‘zephyr-blinky’ example project on the nRF52 platform
After spinning for a while I get an error and the example import aborts.

Importing Arduino examples works flawlessly.

I suspect that is got something to do with a space in my user path “c:\users\FirstnameLastname” as the first error line denotes:

“Installing Zephyr’s Python dependencies
‘C:\Users\Firstname’ is not recognized as an internal or external command,
operable program or batch file.
Error 1”
(entire error log below)

Any advice is appreciated.

Thanks

– Error log –

PIO Core Call Error: "Resolving adafruit_feather_nrf52832 dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...


UserSideException: Processing adafruit_feather_nrf52832 (platform: nordicnrf52; framework: zephyr; board: adafruit_feather_nrf52832)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52832.html
PLATFORM: Nordic nRF52 (10.3.0) > Adafruit Bluefruit nRF52832 Feather
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-cmsis @ 2.50700.210515 (5.7.0) 
 - framework-zephyr @ 2.20701.220422 (2.7.1) 
 - tool-adafruit-nrfutil @ 1.503.0 (5.3) 
 - tool-cmake @ 3.21.3 
 - tool-dtc @ 1.4.7 
 - tool-ninja @ 1.9.0 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Installing Zephyr's Python dependencies
'C:\\Users\\Firstname' is not recognized as an internal or external command,
operable program or batch file.
*** Error 1
ModuleNotFoundError: No module named 'yaml':
 File \"C:\\Users\\Firstname Lastname\\.platformio\\penv\\Lib\\site-packages\\platformio\\builder\\main.py\", line 173:
 env.SConscript(\"$BUILD_SCRIPT\")
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 609:
 return _SConscript(self.fs, *files, **subst_kw)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 279:
 exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\platforms\
ordicnrf52\\builder\\main.py\", line 195:
 target_elf = env.BuildProgram()
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Util\\envs.py\", line 251:
 return self.method(*nargs, **kwargs)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\framework-zephyr\\scripts\\platformio\\platformio-build-pre.py\", line 25:
 env.ProcessProgramDeps()
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Util\\envs.py\", line 251:
 return self.method(*nargs, **kwargs)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\penv\\Lib\\site-packages\\platformio\\builder\\tools\\piobuild.py\", line 121:
 env.BuildFrameworks(env.get(\"PIOFRAMEWORK\"))
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Util\\envs.py\", line 251:
 return self.method(*nargs, **kwargs)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\penv\\Lib\\site-packages\\platformio\\builder\\tools\\piobuild.py\", line 347:
 SConscript(env.GetFrameworkScript(name), exports=\"env\")
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 673:
 return method(*args, **kw)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 609:
 return _SConscript(self.fs, *files, **subst_kw)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 279:
 exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\platforms\
ordicnrf52\\builder\\frameworks\\zephyr.py\", line 28:
 SConscript(
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 673:
 return method(*args, **kw)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 609:
 return _SConscript(self.fs, *files, **subst_kw)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\tool-scons\\scons-local-4.6.0\\SCons\\Script\\SConscript.py\", line 279:
 exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
 File \"C:\\Users\\Firstname Lastname\\.platformio\\packages\\framework-zephyr\\scripts\\platformio\\platformio-build.py\", line 54:
 import yaml
========================== [FAILED] Took 1.50 seconds ==========================

Environment Status Duration
------------------------- -------- ------------
adafruit_feather_nrf52832 FAILED 00:00:01.495
==================== 1 failed, 0 succeeded in 00:00:01.495 ===================*

Seems like as recorded in https://github.com/platformio/platform-nordicnrf52/issues/90. PlatformIO’s script seems to be missing a path escape somewhere. You can try the same workaround but this should be fixed in PlatformIO, pinging the issue again…

Thanks for your prompt reply.

It’s a chicken-and-an-egg situation, Isn’t it?
per the workaround, I need to edit platformio.ini which I fail to import, in order to import it…

Hm no, you can first edit the platformio.ini of the to be imported project with that mod (it’s somewhere in C:\Users\<user>\.platformio\platforms\nordicnrf52\examples\...) and then import it.

But it any case, what is easier is to set a global environment variable that controls this: PLATFORMIO_CORE_DIR per doc. See e.g. here on how to add a environment variable for your user account. You may have to reboot the computer after that and try the import again.