question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When setting "python.pythonPath" to "python", resolve python interpreter in the same way as we resolve 'python' in terminal

See original GitHub issue

Question

Why does setting "python.pythonPath" to "python" trigger automatic path detection instead of regular path resolution as in which python/where python?

The regular path resolution would be much more useful and less counter-intuitive when working with virtual environments or manually compiled python distributions that happens to be placed before the system python installation in the PATH environment variable.

IMO explicitly specifying a setting shouldn’t be treated as not specifying it at all. At the very least it should be clear to the user that the path resolution is only done if the setting is not empty and not equal to "python" (which is still bad but much more transparent to the user).

The line containing the relevant logic can be found here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Sep 4, 2019

Currently, setting "python.pythonPath" to "python" is equivalent to not setting "python.pythonPath" at all. We currently auto-select interpreters in both cases.

The requirement is that when "python.pythonPath" is set to "python", instead of auto-selecting the interpreter, select the same interpreter that is referred to when typing "python xyz.py" in terminal. Hope that’s clearer now.

0reactions
luabudcommented, Oct 30, 2019

Thanks for the suggestion 👍 but we decided not to move forward with this idea for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Settings Reference for Python - Visual Studio Code
Python settings reference. The Python Extension for Visual Studio Code is highly configurable. This page describes the key settings you can work with....
Read more >
Understanding the Python Path Environment Variable in Python
The Pythonpath is a list of directories that the Python interpreter will search for when it tries to resolve a module name. So,...
Read more >
How to correctly set PYTHONPATH for Visual Studio Code
I have a situation that I believe is relatively common. I want a script to import a module from another directory. My python...
Read more >
Selecting the correct Python interpreter in ... - YouTube
These are the settings adjustments you 'll need to make to use a conda Python environment to execute your code inside of VSCode....
Read more >
Configure a Python interpreter | PyCharm Documentation
Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. · Expand the list of the available interpreters ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found