Skip to content

python interpreter in launch task does not override python.defaultInterpreterPath #20171

@weikanglim

Description

@weikanglim

Type: Bug

Behaviour

Expected vs. Actual

I specified a valid python interpreter path on the debug launch task,
image

and inherited an invalid python interpreter path through python.defaultInterpreterPath.
image

I expect the valid interpreter to be used when launching the debugger task. Instead, I get an error about launch.json being invalid (which is inaccurate):
image

This happened unfortunately as part of devcontainers/features#258, where the devcontainer was providing an invalid interpreter path, and trying to fix it by setting the python path override did not help.

Steps to reproduce:

  1. Specify a valid python interpreter path in launch.json
  2. Specify an invalid python interpreter path in settings.json
  3. Launch the debugger on a python file

Alternatively use the minimal repro here https://github.com/weikanglim/devcontainer-python/tree/weilim/invalid-interpreter:

  1. git clone https://github.com/weikanglim/devcontainer-python && cd devcontainer-python && git checkout weilim/invalid-interpreter
  2. Open main.py and hit F5

Expected:
The valid python interpreter is used, and debug successfully launches.

Actual:
An error "The Python path in your debug configuration is invalid." that points to launch.json shows up.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda):
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

[ERROR 2022-10-3 10:37:12.928]: Invalid Python Path 'invalid'

User Settings


languageServer: "Pylance"

Extension version: 2022.18.0
VS Code version: Code 1.73.0 (8fa188b2b301d36553cbc9ce1b0a146ccb93351f, 2022-11-01T15:34:06.111Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2
Connection to 'codespaces+weikanglim-github-template-test-qvrq7wrxwxf45wp' could not be established
Connection to 'codespaces+weikanglim-studious-giggle-xr6w5j6q6426wpv' could not be established
Connection to 'codespaces+weikanglim-supreme-space-robot-5v6qgw656x2p664' could not be established
Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz (36 x 3000)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 63.73GB (27.86GB free)
Process Argv --crash-reporter-id 0ce79a4c-f4f8-4913-a92b-4597f5c231c8
Screen Reader no
VM 0%
Item Value
Remote Dev Container: Azure Developer CLI
OS Linux x64 5.10.102.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz (36 x 2999)
Memory (System) 49.99GB (47.01GB free)
VM 0%

Connection to 'codespaces+weikanglim-github-template-test-qvrq7wrxwxf45wp' could not be established

Connection to 'codespaces+weikanglim-studious-giggle-xr6w5j6q6426wpv' could not be established

Connection to 'codespaces+weikanglim-supreme-space-robot-5v6qgw656x2p664' could not be established

Item Value
Remote Dev Container: Azure Developer CLI
OS Linux x64 5.10.102.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz (36 x 2999)
Memory (System) 49.99GB (47.01GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
fc301958:30595537
2e4cg342:30596373

Metadata

Metadata

Labels

area-debugginginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions