Space in path causes error


I’ve recently bought an arduino but I really wasn’t happy about the default IDE,
so I searched and found PlatformIO (installed on Visual Studio Code).

When I initialize, it works, but when I try to build I get following errormessage:
(I try to build it with the keyboard shortcut (ctrl + alt + b)).

It’s definitly because there is a space in my name but I don’t know how and where to fix this.
I also get some warnings about a space in the output window:

Warning: the task ‘PlatformIO: Build’ is a shell command and either the command name or one of its arguments has unescaped spaces. To ensure correct command line quoting please merge args into the command.

I get one of these for every built-in command there is.
Anyone that can help?

Thanks in advance!

Thanks a lot! I’ve just fixed it!

Please run pio upgrade command in Terminal and Rebuild Project Index (Ctrl+P > PlatformIO: Rebuild…)

1 Like

Somehow those quotes don’t help to escape whitespaces, so exceptions persists.

My current solution is to use PowerShell whitespace escaping:

"command": "C:\\Users\\Yegor` Bobrovski\\.platformio\\penv\\Scripts\\platformio.exe",
"isShellCommand": true,

But platformio overrides my changes on every index rebuild.

Well, another solution is to leave only

"command": "platformio.exe"

and add its location folder to PATH.

Honestly I didn’t test it because I couldn’t find the time until now. Escaping the " characters doesn’t work for me either.
Instead of escaping the " character I use the following: what seems to work for me:

"command": "&'C:\\Users\\Jeroen Claessens\\.platformio\\penv\\Scripts\\platformio.exe'",
"isShellCommand": false,

@ivankravets I created a pull request so please take a look into it:

I noticed that I needed to sign a contribution agreement, which I did after I filed the request.


@Milquour @jclaessens97 could you try upcoming 0.5.0 beta?

Just sharing another note about spaces in the path. If there are doublespaces in the path, that will also cause trouble upon compiling:

Error: Nothing to build. Please put your source code files to 'c:\Users\Rob\Documents\PlatformIO\Projects\1.0 Folder with double spaces\Smokey\src' folder

The compiler converts double spaces to single and then cant find the source files.



I’m facing with the same problem after installed VSCode and PlatformIO plug-in. I’m tring to open a new project for esp32 devKit.

PIO Core Call Error: "The current working directory C:\Users\pippo will be used for the project.\r\n\r\n
The next files/directories have been created in C:\Users\pippo\r\n
include - Put project header files here\r\n
lib - Put here project specific (private) libraries\r\n
src - Put project source files here\r\nplatformio.ini - Project Configuration File\r\n\n\n
Error: Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)\r\n
Verbose mode can be enabled via -v, --verbose option\r\nCONFIGURATION:\r\nPLATFORM: Espressif 32 1.12.1 > Espressif ESP32 Dev Module\r\nHARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash\r\nDEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)\r\nPACKAGES: \r\n

  • framework-espidf 3.40000.200303 (4.0.0) \r\n
  • tool-cmake 3.16.5 \r\n
  • tool-esptoolpy 1.20600.0 (2.6.0) \r\n
  • tool-idf 1.0.1 \r\n
  • tool-mconf 1.4060000.20190628 (406.0.0) \r\n
  • tool-ninja 1.9.0 \r\n
  • toolchain-esp32ulp 1.22851.190618 (2.28.51) \r\n
  • toolchain-xtensa32 2.80200.200226 (8.2.0)\r\n
    Installing ESP-IDF’s Python dependencies\r\n
    “c:\users\pluto” it is not recognized as an internal or external command, \ r \ n
    an executable program or batch file.\r\n
    *** Error 1\r\n
    Error: Detected a whitespace character in project paths.\r\n
    ========================== [FAILED] Took 1.33 seconds =========================="

Are there any whitespaces or latin characters in your username? Where have you saved the project to?

A short-term workaround might be to use the core_dir parameter to instruct platformio to use another directory (i.e. C:\PIO) to store all the platform files, and workspace_dir to have the project build cache and library files stored in another folder (i.e. C:\PIO-build)… but it would be better to fix this properly as this would only be a bandaid at best.

yes the directory has a white space in the username (it is “C:\Users\pippo pippo\…”) and this causes the problem.
So can you tell me where I must put these parameters? Because the project isn’t created, the error shows up immediately when I press the “finish” button in the “Quick Access > +New Project”.

Is possible to install the ESP-IDF’s Python dependencies manually? and how?

No whitespaces in project paths is a limitation from ESP-IDF build system. You can add the following line to your platformio.ini:

core_dir = C:\\.PIO

platform = ...
framework = ...
board = ...

This issue appear when I try to create a new project: after pressed “Finish” in the project wizard.
So I can’t add the line that you suggest, because the file doesn’t exist yet.