Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getExecutionDetails().execCommand returns conda folder instead of executable path #22617

Closed
bernhard-42 opened this issue Dec 9, 2023 · 5 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@bernhard-42
Copy link

Type: Bug

Behaviour

In a custom extension that works with the Python extension, the behaviour of the extension API changed since the last version 1.85.0, Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c

Expected vs. Actual

const extension = vscode.extensions.getExtension("ms-python.python");
await extension.activate();
const pythonPath = extension.exports.settings.getExecutionDetails().execCommand[0];

now returns /opt/miniforge3/envs/cq on a Silicon Mac instead of /opt/miniforge3/envs/cq/bin/python

Steps to reproduce:

see above

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • 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)

XXX

User Settings


languageServer: "Pylance"

Extension version: 2023.22.0
VS Code version: Code 1.85.0 (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T18:17:50.719Z)
OS version: Darwin arm64 22.4.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 3, 3
Memory (System) 32.00GB (0.69GB free)
Process Argv . --crash-reporter-id 43287d2e-bfd5-4241-a50d-76b1a8e77b25
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30899288
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
282f8724:30602487
f6dab269:30613381
a9j8j154:30646983
showlangstatbar:30737416
962ge761:30917236
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30910334
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30902429
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:30885898
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232
dsvsc019:30917259

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 9, 2023
@bernhard-42
Copy link
Author

Looks like the getExecutionDetails API is deprecated. The right way today seems to be:

import { PythonExtension } from '@vscode/python-extension';

let pythonExecutable = "python";  // DEFAULT_PYTHON
const pythonApi: PythonExtension = await PythonExtension.api();
const environmentPath = pythonApi.environments.getActiveEnvironmentPath();
const environment = await pythonApi.environments.resolveEnvironment(environmentPath);
if (environment != null) {
     pythonExecutable environment.path;
}

See https://github.com/microsoft/vscode-python/wiki/Python-Environment-APIs

@eleanorjboyd
Copy link
Member

likely the same issue as #22618.

@karrtikr
Copy link

Fix should be out in the pre-release version of the extension, use the following to try it out:

image

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 14, 2023
@karrtikr
Copy link

And btw, that API is indeed deprecated as you noted, so please switch to using the new API soon.

@bernhard-42
Copy link
Author

@karrtikr already switched, but thanks for the quick fix!

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Dec 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants