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

Run Python File in Terminal does not respect "python.pythonPath" #593

Closed
conradoplg opened this issue Jan 16, 2018 · 6 comments · Fixed by #592
Closed

Run Python File in Terminal does not respect "python.pythonPath" #593

conradoplg opened this issue Jan 16, 2018 · 6 comments · Fixed by #592
Assignees
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug

Comments

@conradoplg
Copy link

Environment data

VS Code version: 1.19.2
Python Extension version: 0.9.1
Python Version: 3.5
OS and version: Ubuntu 16.04 x64

Actual behavior

File is run with python

Expected behavior

File should be run with /usr/bin/python3

Steps to reproduce:

Set

{
    "python.pythonPath": "/usr/bin/python3"
}

and run a file.

Logs

Output from Python output panel

python <file>

Output from Console window (Help->Developer Tools menu)

@DonJayamanne
Copy link

This works for me. How are you running the python file in the terminal?
Note, the command python <file> should be display in the terminal window, not the Python output panel.

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster area-terminal labels Jan 16, 2018
@conradoplg
Copy link
Author

You're right, it's displayed in the terminal.

I'm running with a shortcut assigned to "Run Python File in Terminal".

Weirdly, I've just noticed that if I right click the editor and select the same option, it uses the correct Python version. But using the shortcut, it always uses "python"

@conradoplg
Copy link
Author

BTW it also uses the incorrect version when e.g. it attempts to install pylint via the popup. I had to re-run the pip install command with "python3" in order for the editor to stop warning about missing pylint. (I can open a separate issue for this...)

@DonJayamanne DonJayamanne self-assigned this Jan 17, 2018
@DonJayamanne
Copy link

I'm running with a shortcut assigned to "Run Python File in Terminal"

Please could you try running the above command from the command palette?

@conradoplg
Copy link
Author

Please could you try running the above command from the command palette?

I got the same result (runs with "python").

I'm working on a workspace with multiple folders. I tried "Open folder..." with only the specific folder I'm working with right now, and then the above works. If I reopen the workspace, it stops working.

@DonJayamanne
Copy link

I'm working on a workspace with multiple folders. I tried "Open folder..."

Bingo, I believe that's where the problem lies. This will be fixed in #592

@brettcannon brettcannon added awaiting 2-PR and removed info-needed Issue requires more information from poster labels Jan 18, 2018
DonJayamanne added a commit that referenced this issue Jan 19, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants