LDF error on 4.2.1

The project that I used to compile fine now comes up with an error, I can’t figure out why.
Can you help me.
I suppose it has something to do with the LDF
Should I put something in the platformio.ini to help find the libs.
before 4.2 was compiling fine…

thank you

Processing nucleo_f303re (platform: ststm32@~5.3.0; board: nucleo_f303re; framework: mbed)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f303re.html
PLATFORM: ST STM32 5.3.0 > ST Nucleo F303RE
HARDWARE: STM32F303RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-mbed 5.51105.190312 (5.11.5) 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 7 compatible libraries
Scanning dependencies...
TypeError: string indices must be integers:
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/main.py", line 156:
    env.SConscript("$BUILD_SCRIPT")
  File "/Users/franz/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/Users/franz/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
    exec _file_ in call_stack[-1].globals
  File "/Users/franz/.platformio/platforms/ststm32@5.3.0/builder/main.py", line 90:
    target_elf = env.BuildProgram()
  File "/Users/franz/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 62:
    env.ProcessProjectDeps()
  File "/Users/franz/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 131:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "/Users/franz/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 1035:
    project.search_deps_recursive()
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 423:
    self.depend_recursive(lb, lb_search_files)
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 399:
    lb.search_deps_recursive(search_files)
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 404:
    self.process_dependencies()
  File "/Users/franz/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 279:
    if item["name"] != lb.name:
==================================================================== [FAILED] Took 2.88 seconds ====================================================================
The terminal process terminated with exit code: 1

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

What platformio.ini do you have?

[env:nucleo_f303re]
platform = ststm32@~5.3.0
board = nucleo_f303re
framework = mbed
debug_tool = stlink

It seems related to what has been reported also by others:

There are no libraries declared in the platformio.ini. Can you give a list of used libraries and their library.json for reproduction?

I am using mbed project with ble libaries and IDBXA1 st libs:

the file module.json in the lib dir:

{
  "name": "ble",
  "version": "2.7.0",
  "description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.",
  "keywords": [
    "Bluetooth",
    "BLE",
    "mbed",
    "mbed-official"
  ],
  "author": "Rohit Grover",
  "repository": {
    "url": "https://github.com/ARMmbed/ble.git",
    "type": "git"
  },
  "homepage": "https://developer.mbed.org/teams/Bluetooth-Low-Energy/",
  "licenses": [
    {
      "url": "https://spdx.org/licenses/Apache-2.0",
      "type": "Apache-2.0"
    }
  ],
  "dependencies": {},
  "targetDependencies": {
    "st-ble-shield": {
      "x-nucleo-idb0xa1": "^2.1.0"
    },
    "nrf51822": {
      "ble-nrf51822": "^2.8.0"
    },
    "nrf52832": {
      "ble-nrf52832": "ARMmbed/ble-nrf52832"
    },
    "cordio": {
      "ble-wicentric": "~0.0.4"
    },
    "mbed-classic": {
      "mbed-classic": "~0.0.1"
    },
    "mbed-os": {
      "mbed-drivers": "*",
      "compiler-polyfill": "^1.2.1"
    }
  }
}

Any idea why it does not work? a new bug?

I’d wait for @ivankravets or @valeros to take a look this (and equivalent TypeError: string indices must be integers: · Issue #3400 · platformio/platformio-core · GitHub) at why

Throws TypeError: string indices must be integers when using these specific libraries.

Hope they fix it quickly. Do you know if it is easy to roll back to previous version of PIO on Visualcode?

You might be able to use a PIO terminal and use the uninstall command together with a pip install platformio==<some version> command, with a version from platformio · PyPI and a restart of VSCode. I have not tested this though. Different extension version can be installed easily though (Stop platformio core from updating - #2 by pfeerick), but that’s probably not what you want, since the core stays the same.

Could you provide a demo project to reproduce this issue? This works for me

[env:nucleo_f303re]
platform = ststm32@~5.3.0
board = nucleo_f303re
framework = mbed
debug_tool = stlink

Fixed in

Did not get any template youmention in your post. I would gladly attach the project directory if you wish.
Below some configs files in my. project.
Asstated earlier, problems arose only after upgrading to 4.2.1

mbed_app.json:
{
“target_overrides”: {
“*”: {
“platform.stack-stats-enabled”: true,
“platform.heap-stats-enabled”: true,
“platform.cpu-stats-enabled”: true,
“platform.thread-stats-enabled”: true,
“platform.sys-stats-enabled”: true,
“target.lse_available”: false,
“target.clock_source”: “USE_PLL_HSE_XTAL”,
“target.stdio_uart_tx”: “PA_9”,
“target.stdio_uart_rx”: “PA_10”,
“platform.stdio-baud-rate”: 9600
}
}
}
platform.ini:
[env:nucleo_f303re]
platform = ststm32@~5.3.0
board = nucleo_f303re
framework = mbed
debug_tool = stlink

lib dir content:
BLE_API/module.json
{
“name”: “ble”,
“version”: “2.7.0”,
“description”: “The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.”,
“keywords”: [
“Bluetooth”,
“BLE”,
“mbed”,
“mbed-official”
],
“author”: “Rohit Grover”,
“repository”: {
“url”: “GitHub - ARMmbed/ble: API to abstract working with Bluetooth Smart Controllers”,
“type”: “git”
},
“homepage”: “Bluetooth Low Energy | Mbed”,
“licenses”: [
{
“url”: “Apache License 2.0 | Software Package Data Exchange (SPDX)”,
“type”: “Apache-2.0”
}
],
“dependencies”: {},
“targetDependencies”: {
“st-ble-shield”: {
“x-nucleo-idb0xa1”: “^2.1.0”
},
“nrf51822”: {
“ble-nrf51822”: “^2.8.0”
},
“nrf52832”: {
“ble-nrf52832”: “ARMmbed/ble-nrf52832”
},
“cordio”: {
“ble-wicentric”: “~0.0.4”
},
“mbed-classic”: {
“mbed-classic”: “~0.0.1”
},
“mbed-os”: {
“mbed-drivers”: “*”,
“compiler-polyfill”: “^1.2.1”
}
}
}

X_NUCLEO_IDB0XA1/module.json

{
“name”: “x-nucleo-idb0xa1”,
“version”: “2.1.0”,
“description”: “ST driver for the mbed BLE API.”,
“keywords”: [
“expansion”,
“board”,
“x-nucleo”,
“nucleo”,
“ST”,
“STM”,
“Bluetooth”,
“BLE”
],
“author”: “Andrea Palmieri”,
“repository”: {
“url”: “GitHub - ARMmbed/ble-x-nucleo-idb0xa1: port of BLE_API to ST BLE shield”,
“type”: “git”
},
“homepage”: “GitHub - ARMmbed/ble-x-nucleo-idb0xa1: port of BLE_API to ST BLE shield”,
“licenses”: [
{
“url”: “Apache License 2.0 | Software Package Data Exchange (SPDX)”,
“type”: “Apache-2.0”
}
],
“extraIncludes”: [
“x-nucleo-idb0xa1”,
“x-nucleo-idb0xa1/utils”,
“x-nucleo-idb0xa1/platform”,
“x-nucleo-idb0xa1/bluenrg-hci”
],
“dependencies”: {
“mbed-drivers”: “>=0.11.3”,
“ble”: “^2.7.0”
}
}

Yes, please share project on Dropbox, Google Drive, or similar service and attach link here. Thanks!

Here is my project:

Any news? Have you had time to investigate.
Thank you for your great support.
Keep up with the excellent work

Hi @franzle! I couldn’t reproduce the issue with that latest platformio-core, so it’d great if you could just run pio upgrade --dev in the VSCode terminal window and try to compile your project again?

Great! Now problem solved with 4.2.2b1!

TypeError: means that you are trying to perform an operation on a value whose type is not compatible with that operation. If you are accessing items from a dictionary , make sure that you are accessing the dictionary itself and not a key in the dictionary. TypeError: string indices must be integers has been caused because you are trying to access values from dictionary using string indices instead of integer.