Skip to content

Commit 7937a18

Browse files
authored
Modifies setup_vscode.py to keep the default interpreter in devcontainers (#559)
# Description Changes made in [PR #628](455a174) caused using the VSCode Debugger from `isaac-lab-base/-ros2` to no longer function because `python.sh` was not being called. This is because even though `{workspace}/_isaac_sim/python.sh` is initially set as the default, `setup_vscode.py` replaces it with the python binary that `python.sh` invokes, but without using `python.sh` certain envar modifications don't happen such that e.g. `PYTHONPATH` is broken and imports don't work. This change checks if the calling executable matches the exact path we expect with the isaac-lab containers, and then keeps it as the default if it does. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 36e3abf commit 7937a18

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.vscode/tools/setup_vscode.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ def overwrite_default_python_interpreter(isaaclab_settings: str) -> str:
132132
"""
133133
# read executable name
134134
python_exe = sys.executable.replace("\\", "/")
135+
136+
# We make an exception for replacing the default interpreter if the
137+
# path (/kit/python/bin/python3) indicates that we are using a local/container
138+
# installation of IsaacSim. We will preserve the calling script as the default, python.sh.
139+
# We want to use python.sh because it modifies LD_LIBRARY_PATH and PYTHONPATH
140+
# (among other envars) that we need for all of our dependencies to be accessible.
141+
if "kit/python/bin/python3" in python_exe:
142+
return isaaclab_settings
135143
# replace the default python interpreter in the Isaac Lab settings file with the path to the
136144
# python interpreter in the Isaac Lab directory
137145
isaaclab_settings = re.sub(

0 commit comments

Comments
 (0)