Error in Debug Console when start debugging (ESP32)

Hi all,

I’m trying to debug using an ESP-prog and a ESP32 and it is not working.

I get the following in the debug console when I click start debuggging:

Processing lolin32 (platform: espressif32; framework: arduino; board: lolin32)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 1.9.0 > WEMOS LOLIN32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: 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)
 - framework-arduinoespressif32 2.10002.190628 (1.0.2) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio\build\lolin32\firmware.elf
Checking size .pio\build\lolin32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13460 bytes from 327680 bytes)
Flash: [==        ]  15.1% (used 198512 bytes from 1310720 bytes)
========================= [SUCCESS] Took 2.04 seconds =========================
undefinedError: Traceback (most recent call last):
  File "c:\users\brian\.platformio\penv\lib\site-packages\platformio\", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 717, in main
    rv = self.invoke(ctx)
  File "c:\users\brian\.platformio\penv\lib\site-packages\platformio\commands\", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\brian\.platformio\penv\lib\site-packages\click\", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\brian\.platformio\penv\lib\site-packages\platformio\commands\debug\", line 151, in cli
    from platformio.commands.debug.client import GDBClient, reactor
  File "c:\users\brian\.platformio\penv\lib\site-packages\platformio\commands\debug\", line 34, in <module>
    from platformio.commands.debug.server import DebugServer
SyntaxError: 'return' with argument inside generator (, line 121)


I’ve installed the ESP-prog drivers as per this link:

I’m using a shield for connecting the ESP-prog to the ESP32 (D1 mini style one). I’ve used this shield before so I know the wiring is ok.

I’m using the latest version of PlatformIO (Core4.3) from the Visual studio code extension installer. I’m on Windows 10

Any suggestion to what I can try?


Looking at [v0.1.20/py2.7] SyntaxError: 'return' with argument inside generator · Issue #46 · asweigart/pyscreeze · GitHub and Python SyntaxError: ("'return' with argument inside generator",) - Stack Overflow it may be related to the Python version. When opening a PIO terminal, what Python version are you running or have you installed in the system?

Also, are all packages updated (pio platforms update)?

Hey Max, Thanks for the reply, when I run python --version in the pio terminal I get

Python 2.7.13

Running pio platform update did update some things, but the error persists.

One thing that might be worth mentioning is that I previously had a PIO install on this machine and delete VScode so I could go through the setup process again for a video, so im not sure if I left it in a bad state or whatever. If you suggest starting fresh could you please advise if there are steps for completely removing the pio install?

python3 --version

I think you need at least 3.3, but I’m using 3.7.5 on Linux.

This is a bug on our side with Python 2.7 and has been just fixed in Fixed an error "SyntaxError: 'return' with argument inside generator"… · platformio/platformio-core@6b2ff04 · GitHub
Please upgrade to the development version of PIO Core via pio upgrade --dev or install Python 3, remove c:\users\***\.platformio\penv folder and restart VSCode.

We plan to issue a hotfix PIO Core 4.3.1 release soon. Sorry for the issue.

1 Like

Thank you @ivankravets, will check it out after work.

I updated to dev and it worked, thank you!