Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
- debugpy version: 1.8.14
- OS and version: Debian 12, Mac OS 15.5
- Python version (& distribution if applicable, e.g. Anaconda): python3.9, python3.11
- Using VS Code or Visual Studio: VS Code
Actual behavior
sys.path contains current script directory in isolated mode (-I) with debugpy.
Relevant code is in cli.py, looks like debugpy should check for isolated mode before doing sys.path.insert(0, dir)
Expected behavior
debugpy respects isolated mode and sys.path under debugpy running in isolated mode doesn't contain current script directory
Steps to reproduce:
sys.path contains directory of the script being run in isolated mode with debugpy:
python -I -m debugpy --listen 5678 -c 'import sys; print(f"{sys.path[0]=!r}")'
sys.path[0]=''
sys.path doesn't contain script directory in isolated mode without debugpy:
python -I -c 'import sys; print(f"{sys.path[0]=!r}")'
sys.path[0]='/opt/homebrew/Cellar/python@3.9/3.9.22/Frameworks/Python.framework/Versions/3.9/lib/python39.zip'
Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
Actual behavior
sys.path contains current script directory in isolated mode (-I) with debugpy.
Relevant code is in cli.py, looks like debugpy should check for isolated mode before doing
sys.path.insert(0, dir)Expected behavior
debugpy respects isolated mode and sys.path under debugpy running in isolated mode doesn't contain current script directory
Steps to reproduce:
sys.path contains directory of the script being run in isolated mode with debugpy:
sys.path doesn't contain script directory in isolated mode without debugpy: