PlatformIO Community

Debug fails (undefined error) for STM32F103RE

Error in Debug Console when I click run

undefinedError: Traceback (most recent call last):
  File "C:\Users\User\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\User\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\User\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\User\.platformio\penv\lib\site-packages\platformio\commands\debug\command.py", line 167, in cli
    from platformio.commands.debug.process.client import GDBClient, reactor
  File "C:\Users\User\.platformio\penv\lib\site-packages\platformio\commands\debug\process\client.py", line 23, in <module>
    from twisted.internet import defer  # pylint: disable=import-error
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\internet\defer.py", line 32, in <module>
    from twisted.logger import Logger
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\logger\__init__.py", line 102, in <module>
    from ._logger import Logger, _loggerFor
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\logger\_logger.py", line 274, in <module>
    _log = Logger()
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\logger\_logger.py", line 70, in __init__
    from ._global import globalLogPublisher
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\logger\_global.py", line 16, in <module>
    from ._buffer import LimitedHistoryLogObserver
  File "C:\Users\User\.platformio\packages\contrib-pysite\twisted\logger\_buffer.py", line 11, in <module>
    from zope.interface import implementer
ModuleNotFoundError: No module named 'zope'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

ini file below:
[env:genericSTM32F103RE]

platform = ststm32

board = genericSTM32F103RE

framework = arduino

lib_deps =

bodmer/TFT_eSPI@^2.3.70

greiman/SdFat@^2.1.0

debug_tool = stlink

upload_protocol = stlink

I am using a SDLinkv2 SCLK and SWDIO GND and VCC, which works fine for uploading.

Any ideas?

Did some work on it and it looks like it was just python packages missing.

I did the following to fix it:

pip install zope.interface

pip install pywin32 

Did i miss an install step or is this a bug?

thanks

PlatformIO should install all needed Python packages upon its first installation.

Did you execute that in the global pip installation of your system or PlatformIO’s (in C:\Users\<user>\.platformio\penv)? PlatformIO runs in its own isolated python environment and thus shouldn’t rely on packages installed in the system’s pip.

Does this occurr after a fresh reinstall too? To do that,

  • remove the PlatformIO extension from VSCode and close VSCode
  • remove the folder C:\Users\User\.platformio\
  • re-open VSCode, reinstall PlatformIO, restart VSCode after installation has finished
  • retry building the project first, then debugging.