Skip to content

Commit

Permalink
Merge branch 'bugfix/failed_module_import_v5.0' into 'release/v5.0'
Browse files Browse the repository at this point in the history
fix(tools): extend error message for failed python module import (v5.0)

See merge request espressif/esp-idf!25869
  • Loading branch information
dobairoland committed Sep 15, 2023
2 parents 58392ec + ca31d75 commit 0b86f34
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@
debug_print_idf_version, get_target, merge_action_lists, print_warning)
if os.getenv('IDF_COMPONENT_MANAGER') != '0':
from idf_component_manager import idf_extensions
except ImportError:
except ImportError as e:
# For example, importing click could cause this.
print('Please use idf.py only in an ESP-IDF shell environment.', file=sys.stderr)
print((f'Cannot import module "{e.name}". This usually means that "idf.py" was not '
f'spawned within an ESP-IDF shell environment or the python virtual '
f'environment used by "idf.py" is corrupted.\n'
f'Please use idf.py only in an ESP-IDF shell environment. If problem persists, '
f'please try to install ESP-IDF tools again as described in the Get Started guide.'),
file=sys.stderr)

sys.exit(1)

# Use this Python interpreter for any subprocesses we launch
Expand Down

0 comments on commit 0b86f34

Please sign in to comment.