diff --git a/HISTORY.rst b/HISTORY.rst index 16b8a6a1..23e756ea 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,7 @@ PlatformIO Core 6 * Made assets (templates, ``99-platformio-udev.rules``) part of Python's module (`issue #4458 `_) * Updated `Clang-Tidy `__ check tool to v15.0.5 with new diagnostics and bugfixes * Removed dependency on the "zeroconf" package and install it only when a user lists mDNS devices (issue with zeroconf's LGPL license) +* Show the real error message instead of "Can not remove temporary directory" when "platform.ini" is broken (`issue #4480 `_) 6.1.5 (2022-11-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/project/config.py b/platformio/project/config.py index 3443863a..265fa95d 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -319,7 +319,13 @@ class ProjectConfigBase: if section == "this": section = parent_section if option == "__env__": - assert parent_section.startswith("env:") + if not parent_section.startswith("env:"): + raise exception.ProjectOptionValueError( + f"`${{this.__env__}}` is called from the `{parent_section}` " + "section that is not valid PlatformIO environment, see", + option, + section, + ) return parent_section[4:] # handle nested calls try: diff --git a/platformio/run/cli.py b/platformio/run/cli.py index adf0153f..6c647431 100644 --- a/platformio/run/cli.py +++ b/platformio/run/cli.py @@ -24,6 +24,7 @@ from tabulate import tabulate from platformio import app, exception, fs, util from platformio.device.monitor.command import device_monitor_cmd from platformio.project.config import ProjectConfig +from platformio.project.exception import ProjectError from platformio.project.helpers import find_project_dir_above, load_build_metadata from platformio.run.helpers import clean_build_dir, handle_legacy_libdeps from platformio.run.processor import EnvironmentProcessor @@ -115,6 +116,8 @@ def cli( build_dir = config.get("platformio", "build_dir") try: clean_build_dir(build_dir, config) + except ProjectError as exc: + raise exc except: # pylint: disable=bare-except click.secho( "Can not remove temporary directory `%s`. Please remove "