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

Setting python.pythonPath to a directory does not work unless there is a path separator #2744

Closed
brettcannon opened this issue Oct 1, 2018 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@brettcannon
Copy link
Member

E.g., setting "python.pythonPath": ".venv" makes the extension think no interpreter is set, but ".\\.venv" and ".venv\\" fixes the issue.

@brettcannon brettcannon added feature-interpreter bug Issue identified by VS Code Team member as probable bug labels Oct 1, 2018
@DonJayamanne
Copy link

@brettcannon
The path needs to be relative, i.e. you need to ensure it is prefixed with ./xxx
If you include xxx as pythonPath, then its treated as the name of the executable, such as having pythonPath:"python".
I.e. how do you differentiate between pythonPath:"python" and pythonPath:"python35"
They could both be directories or names of commands in current path.
So, it used to work and still does, provided the path is relative, i.e. its a PATH with the prefix ./, meaning its relative to the current workspace.

Based on the above info, what would you like us to do?

Note: One problem is when selecting the path using the UI, we need to ensure it is prefixed with ./ for relative paths. Currently we don't do that. I'll fix that.

@DonJayamanne
Copy link

The only solution is to check if there's a sub directory with the name as defined in pythonPath. Only when pythonPath is one word (without any / or \).

@brettcannon
Copy link
Member Author

Decided to not prepend a . as it gets dropped on Windows and otherwise didn't add enough usefulness to keep it only for UNIX.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants