Problem
During extension startup, two noisy error patterns appear in the output log:
1. workspaceSearchPaths error logged multiple times per session
The error python-envs.workspaceSearchPaths is set at the user/global level, but this setting can only be set at the workspace or workspace folder level is logged every time getWorkspaceSearchPaths() is called. Since configure() is called before every doRefresh() and resolve() operation during startup, the same error appears 6-8 times in a single activation.
This violates the project guideline: "Avoid showing the same error message multiple times in a session."
2. Unresolved ${workspaceFolder} passed to PET resolve
When python.defaultInterpreterPath is set to ${workspaceFolder}/.venv/bin/python3 and the priority chain runs in global scope (no workspace folder), resolveVariables() cannot resolve ${workspaceFolder}. The literal string ${workspaceFolder}/.venv/bin/python3 is then sent to PET's resolve RPC, which fails with:
Failed to execute Python to resolve info "${workspaceFolder}/.venv/bin/python3": No such file or directory (os error 2)
The extension does recover via auto-discovery fallback, but the PET error is unnecessary and alarming to users.
Expected Behavior
- The
workspaceSearchPaths global-level warning should be logged at most once per session
- Paths with unresolved variables (
${...}) should be detected before calling PET resolve, with a clear warning and immediate fallback to auto-discovery
Reproduction
- Set
python-envs.workspaceSearchPaths at the user/global level in settings.json
- Set
python.defaultInterpreterPath to ${workspaceFolder}/.venv/bin/python3
- Open a workspace — observe repeated errors in the Python Environments output channel
Problem
During extension startup, two noisy error patterns appear in the output log:
1.
workspaceSearchPathserror logged multiple times per sessionThe error
python-envs.workspaceSearchPaths is set at the user/global level, but this setting can only be set at the workspace or workspace folder levelis logged every timegetWorkspaceSearchPaths()is called. Sinceconfigure()is called before everydoRefresh()andresolve()operation during startup, the same error appears 6-8 times in a single activation.This violates the project guideline: "Avoid showing the same error message multiple times in a session."
2. Unresolved
${workspaceFolder}passed to PET resolveWhen
python.defaultInterpreterPathis set to${workspaceFolder}/.venv/bin/python3and the priority chain runs in global scope (no workspace folder),resolveVariables()cannot resolve${workspaceFolder}. The literal string${workspaceFolder}/.venv/bin/python3is then sent to PET'sresolveRPC, which fails with:The extension does recover via auto-discovery fallback, but the PET error is unnecessary and alarming to users.
Expected Behavior
workspaceSearchPathsglobal-level warning should be logged at most once per session${...}) should be detected before calling PET resolve, with a clear warning and immediate fallback to auto-discoveryReproduction
python-envs.workspaceSearchPathsat the user/global level in settings.jsonpython.defaultInterpreterPathto${workspaceFolder}/.venv/bin/python3