Cannot upload - file or directory not found (space in path)

I recently changed the projects_dir setting of my installation which worked just fine, however since then I can no longer upload projects to my boards.

pio settings set projects_dir "C:\Users\richa\Google Drive\PlatformIO"

The esptool command fails claiming it can’t find a file or directory called “C:\Users\richa\Google”. Evidently the space in my path is terminating the string early.

esptool write_flash: error: argument <address> <filename>: [Errno 2] No such file or directory: 'C:\\Users\\richa\\Google'. *** [upload] Error 2

Turning on verbose output, I can see the entire esptool command being run and can see that it references paths at several points, but while some of them are wrapped in quotation marks, others aren’t.

"c:\users\richa\.platformio\penv\scripts\python.exe" "C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\esptool.py" --before default_reset --after hard_reset --chip esp32 --port "COM4" --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\sdk\bin\bootloader_dio_40m.bin 0x8000 C:\Users\richa\Google Drive\Developments\PlatformIO\BirdBox Security\.pioenvs\heltec_wifi_lora_32\partitions.bin 0xe000 C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin 0x10000 .pioenvs\heltec_wifi_lora_32\firmware.bin

Rerunning that command myself manually in a terminal window, but wrapping all the paths in quotations works just fine.

"c:\users\richa\.platformio\penv\scripts\python.exe" "C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\esptool.py" --before default_reset --after hard_reset --chip esp32 --port "COM4" --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 "C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\sdk\bin\bootloader_dio_40m.bin" 0x8000 "C:\Users\richa\Google Drive\Developments\PlatformIO\BirdBox Security\.pioenvs\heltec_wifi_lora_32\partitions.bin" 0xe000 "C:\Users\richa\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin 0x10000 .pioenvs\heltec_wifi_lora_32\firmware.bin"

Is there someway to force the quotations marks to avoid having to run the command manually?

I’m running on Windows 10 with the latest version of PIO (Home 0.6.1, Core 3.5.2a8) in Visual Studio Code.

Thanks

Please PIO Home > Platforms > Updates

As if by magic, there is an update available to the Espressif 32 platform today from version 0.11.0 to version 0.12.0 :wink:

It’s absolutely fixed the issue, thank you so much @ivankravets :+1:

1 Like

I’ve just moved my project across to a fresh install of windows and am having the exact same issue (on the Espressif 32 platform).

My new user name has a space, and the upload process is cutting it off at the space.

Unfortunately I have already attempted to get latest, but no luck.

Help?

Could you open PlatformIO IDE Terminal and type pio run -t upload -v and share here the last lines with errors?

Sure can. -i’ll post the whole lot

PS C:\Users\Chris Masiero\Documents\PlatformIO\Projects\HelloWorld> pio run -t upload -v
Processing nodemcu-32s (platform: espressif32; monitor_speed: 115200; board: nodemcu-32s; framework: espidf)

PLATFORM: Espressif 32 > NodeMCU-32S
SYSTEM: ESP32 240MHz 320KB RAM (4MB Flash)
DEBUG: CURRENT(minimodule) EXTERNAL(minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny)
Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies…
No dependencies
([“checkprogsize”], [“.pioenvs\nodemcu-32s\firmware.elf”])
MethodWrapper([“checkprogsize”], [“.pioenvs\nodemcu-32s\firmware.elf”])
Memory Usage → Redirecting...
DATA: [ ] 3.0% (used 9980 bytes from 327680 bytes)
PROGRAM: [= ] 13.0% (used 135864 bytes from 1048576 bytes)
.pioenvs\nodemcu-32s\firmware.elf :
section size addr
.rtc.text 0 1074528256
.iram0.vectors 1024 1074266112
.iram0.text 30320 1074267136
.dram0.data 7924 1073479680
.dram0.bss 2056 1073487608
.flash.rodata 19436 1061158944
.flash.text 77160 1074593816
.comment 303 0
.xtensa.info 56 0
.debug_line 115890 0
.debug_info 182738 0
.debug_abbrev 30397 0
.debug_aranges 3696 0
.debug_str 30161 0
.debug_frame 8864 0
.debug_loc 112389 0
.debug_ranges 3944 0
Total 626358
([“upload”], [“.pioenvs\nodemcu-32s\firmware.bin”])
AVAILABLE: esptool, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny
CURRENT: upload_protocol = esptool
MethodWrapper([“upload”], [“.pioenvs\nodemcu-32s\firmware.bin”])
Auto-detected: COM3
“c:\users\chris masiero.platformio\penv\scripts\python.exe” “C:\Users\Chris Masiero.platformio\packages\tool-esptoolpy\esptool.py” --chip esp32 --port “COM3” --baud 921600 --before default_reset --after
hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\Chris Masiero\Documents\PlatformIO\Projects\HelloWorld.pioenvs\nodemcu-32s\bootloader.bin 0x8000 C:\Users\Chris Masiero\Documents\PlatformIO\Projects\HelloWorld.pioenvs\nodemcu-32s\partitions.bin 0x10000 .pioenvs\nodemcu-32s\firmware.bin
usage: esptool write_flash [-h] [–flash_freq {keep,40m,26m,20m,80m}]
[–flash_mode {keep,qio,qout,dio,dout}]
[–flash_size FLASH_SIZE]
[–spi-connection SPI_CONNECTION] [–no-progress]
[–verify] [–compress | --no-compress]

[ ...] esptool write_flash: error: argument : [Errno 2] No such file or directory: 'C:\\Users\\Chris' *** [upload] Error 2 ======================================================================================== [ERROR] Took 10.29 seconds ======================================================================================== PS C:\Users\Chris Masiero\Documents\PlatformIO\Projects\HelloWorld>

I’ve just checked this in my VM and can’t reproduce. Do you use the latest VSCode and PIO Core?
Please run the next tasks:

  • Menu > Tasks > Run Tasks… > PlatformIO: Upgrade PlatformIO Core
  • Menu > Tasks > Run Tasks… > PlatformIO: Update installed platforms, …

Hi Ivan - thanks for assisting. No luck with either of them.
(I have two Expressif 32 platforms because I also tried to get latest git release on one of the builds to see if that did anything).

Executing task: C:\Users\Chris Masiero.platformio\penv\Scripts\platformio.exe upgrade <

You’re up-to-date!
PlatformIO 3.6.0a6 is currently the newest version available.

Executing task: C:\Users\Chris Masiero.platformio\penv\Scripts\platformio.exe update <

Updating tool-scons @ 2.20501.4 [Up-to-date]
Updating tool-unity @ 1.20403.0 [Up-to-date]
Updating contrib-pysite @ 0.3.0 [Up-to-date]
Updating contrib-piohome @ 0.9.6 [Up-to-date]
Updating tool-pioplus @ 1.3.6 [Up-to-date]

Platform Manager

Platform Espressif 32

Updating espressif32 @ 1.1.2 [Up-to-date]
Updating toolchain-xtensa32 @ 2.50200.80 [Up-to-date]
Updating tool-mkspiffs @ 2.230.0 [Up-to-date]
Updating framework-arduinoespressif32 @ 1.6.0 [Up-to-date]
Updating tool-espotapy @ 1.1.1 [Up-to-date]
Updating framework-espidf @ 2.301.0 [Up-to-date]
Updating tool-esptoolpy @ 1.20410.0 [Up-to-date]

Platform Espressif 32

Updating espressif32 @ f8c2f32 [Up-to-date]
Updating toolchain-xtensa32 @ 2.50200.80 [Up-to-date]
Updating tool-mkspiffs @ 2.230.0 [Up-to-date]
Updating framework-arduinoespressif32 @ 1.6.0 [Up-to-date]
Updating tool-espotapy @ 1.1.1 [Up-to-date]
Updating framework-espidf @ 2.301.0 [Up-to-date]
Updating tool-esptoolpy @ 1.20410.0 [Up-to-date]

Library Manager

Terminal will be reused by tasks, press any key to close it.

Please file issue here Issues · platformio/platform-espressif32 · GitHub