Skip to content

Test: Improvements to "No Python interpreter" selected prompts #19550

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

Closed
2 tasks done
karrtikr opened this issue Jul 25, 2022 · 6 comments
Closed
2 tasks done

Test: Improvements to "No Python interpreter" selected prompts #19550

karrtikr opened this issue Jul 25, 2022 · 6 comments

Comments

@karrtikr
Copy link

karrtikr commented Jul 25, 2022

Refs: #17667

Complexity: 3

Create Issue


Requirements:

  • Access to a machine with no Python installed, maybe a devcontainer for linux.
  • Pre-release version of the Python extension installed

Steps:

Case 1: No Python installed

  • Open a Python file, and use button on top right to run it:
    image
  • Verify the following prompt shows up:
    image
  • Verify clicking Select Interpreter opens the quickpick saying:
    image

Case 2: Invalid Python selected

  • Have Python installed.
  • Select an invalid interpreter. You can use Python: Select Interpreter command and choose Enter interpreter path... item.
  • Verify following prompt shows up on running Python file in this case:
    image

Case 3: Invalid Python selected: multiroot scenario with multiple workspace folders opened

  • In this case verify the prompt message describes the workspace folder affected:
    image
@karrtikr karrtikr changed the title Test: Improvements to environment prompts when an invalid Python is selected or Python is not installed Test: Improvements to interpreter prompts when an invalid Python is selected or Python is not installed Jul 25, 2022
@karrtikr karrtikr changed the title Test: Improvements to interpreter prompts when an invalid Python is selected or Python is not installed Test: Improvements to "No Python interpreter" selected prompts Jul 25, 2022
@ghost ghost assigned isidorn and bamurtaugh Jul 26, 2022
@isidorn
Copy link

isidorn commented Jul 26, 2022

The devcontainers for linux that I tried all have python installed.
@bamurtaugh @karrtikr is there some container you recommend using for this case that does not have python?

@karrtikr
Copy link
Author

karrtikr commented Jul 26, 2022

@isidorn I'm not sure about that, can you try deleting the path to python binary? You can get path to binary using:

python -c"import sys;print(sys.executable)"
python3 -c"import sys;print(sys.executable)"

and delete or rename the files like #19549 (comment).

@bamurtaugh
Copy link
Member

@bamurtaugh @karrtikr is there some container you recommend using for this case that does not have python?

@isidorn I'm thinking our dev container templates have Python in them since their base Linux distro has Python - I've asked our dev containers working group to confirm.

Here's what I've now ultimately done:

  • Opened a project in a dev container as the root user in the container
  • Used @karrtikr's recommended commands for finding the path to the Python binary
  • rm -r python3 in the path from above (which was /usr/bin)
  • Now when I run python3 --version I get: bash: /usr/bin/python3: No such file or directory

@bamurtaugh
Copy link
Member

@karrtikr Actually as an amendment to above, it looks like I can still run Python files, so removing the folder didn't work. Do you have a recommended command to delete the path to the Python binary?

@karrtikr
Copy link
Author

it looks like I can still run Python files

  • What is the command being used to run it?
  • What is the path to binary that it's using, is that deleted? Use python -c"import sys;print(sys.executable)" to get the full path.

An alternative could be to run Python: Select Interpreter command and delete every binary file listed there.

@isidorn
Copy link

isidorn commented Jul 27, 2022

I was able to rm all instances of python that were listed in the Python: Select Interpreter command and then test this item. Thanks for help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants