You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Notification when starting debugging and no interpreter has been selected #2494
If you start debugging and no environment is selected, you just get an error with no explanation.
I suggest if no Python environment is selected, we pop up a notification:
You need to select a Python interpreter before you start debugging.
Tip: click on "Select Python Environment" in the status bar.
[ Select Python Interpreter ]
changed the title [-]Banner when start debugging and no interpreter has been selected[/-][+]Notification when starting debugging and no interpreter has been selected[/+]on Sep 6, 2018
I don't know if this is related exactly to what you're describing above, but today I started up a new folder / project for Python for my class and it wasn't debugging like the previous two folders / projects I had been working in.
I ended up comparing some things between the two and noticed that one had this setup in the Workspace Settings file:
Once I ended up adding that snippet in to the new folder I was able to debug successfully again but am not sure what I may have done to result in the change (I don't use Python a whole lot and haven't been using Visual Studio Code a whole lot either...I'm basically just looking for a quick/seamless way of running my simple Python code needed for class).
This is basically the error I was receiving initially before making the change above:
PS C:\my-python-project> cd 'c:\my-python-project'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; ${env:PYTHONPATH}='c:\Users\example\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd'; & 'python' '-m' 'ptvsd' '--host' 'localhost' '--port' '51262' 'c:\my-python-project\example.py'
& : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:210
+ ... n.python-2018.8.0\pythonFiles\experimental\ptvsd'; & 'python' '-m' 'p ...
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Omar Ramos (@orware) yes that's related! Instead of printing an error to the console we should pop up a notification with guidance on how to fix it.
Debugging won't work if you haven't selected a Python interpreter. To set the interpreter you don't actually need to edit settings.json, you can click on the yellow warning icon in the status bar and select Anaconda:
Can you let me know if you see that warning icon and if debugging works after you click on it + select the desired interpreter? If not, we'll have to investigate further.
As to why you have to keep modifying the setting for new projects, the Workspace Settings file only apply to the current folder you're working on, so you need to add that to every workspace you work in. To make it apply to all workspaces, you can edit your User settings file instead.
Dan Taylor (@qubitron) so I was about to respond and say I didn't see that in the status bar (but I was looking over on the far right, rather than the far left and then noticed it there).
After clicking on it and selecting the Anaconda environment it was able to Run with or w/o debugging just fine so I think that solves the issue for me ;-).
I did get the prompt regarding installing the new user version of VS Code a few weeks ago but decided against installing it for the time being, but I'll check to see if I can adjust that User Settings file you mentioned to make things perhaps a little easier for me down the road, but clicking on that icon once per folder is not too bad (now that I know where it is ;-).
Activity
[-]Banner when start debugging and no interpreter has been selected[/-][+]Notification when starting debugging and no interpreter has been selected[/+]orware commentedon Sep 6, 2018
I don't know if this is related exactly to what you're describing above, but today I started up a new folder / project for Python for my class and it wasn't debugging like the previous two folders / projects I had been working in.
I ended up comparing some things between the two and noticed that one had this setup in the Workspace Settings file:
Whereas the other one did not.
Once I ended up adding that snippet in to the new folder I was able to debug successfully again but am not sure what I may have done to result in the change (I don't use Python a whole lot and haven't been using Visual Studio Code a whole lot either...I'm basically just looking for a quick/seamless way of running my simple Python code needed for class).
This is basically the error I was receiving initially before making the change above:
qubitron commentedon Sep 6, 2018
Omar Ramos (@orware) yes that's related! Instead of printing an error to the console we should pop up a notification with guidance on how to fix it.
Debugging won't work if you haven't selected a Python interpreter. To set the interpreter you don't actually need to edit settings.json, you can click on the yellow warning icon in the status bar and select Anaconda:

Can you let me know if you see that warning icon and if debugging works after you click on it + select the desired interpreter? If not, we'll have to investigate further.
As to why you have to keep modifying the setting for new projects, the Workspace Settings file only apply to the current folder you're working on, so you need to add that to every workspace you work in. To make it apply to all workspaces, you can edit your User settings file instead.
orware commentedon Sep 6, 2018
Dan Taylor (@qubitron) so I was about to respond and say I didn't see that in the status bar (but I was looking over on the far right, rather than the far left and then noticed it there).
After clicking on it and selecting the Anaconda environment it was able to Run with or w/o debugging just fine so I think that solves the issue for me ;-).
I did get the prompt regarding installing the new user version of VS Code a few weeks ago but decided against installing it for the time being, but I'll check to see if I can adjust that User Settings file you mentioned to make things perhaps a little easier for me down the road, but clicking on that icon once per folder is not too bad (now that I know where it is ;-).
qubitron commentedon Sep 7, 2018
Great, we'll have to think about how to make this more discoverable.
qubitron commentedon Sep 10, 2018
brettcannon commentedon Sep 10, 2018
ZhaoTongxue please open a separate issue for your problem as I don't think it is related to this issue.
zhaoyewei commentedon Sep 11, 2018
Brett Cannon (@brettcannon) Sorry,I did it and deleted my comment on this issue. thank you.
Dan Taylor (@qubitron) I show my message on this issue(#2537 )
14 remaining items
brettcannon commentedon Sep 20, 2018
This seems to always pop up when using Python 2.7.
Revert to old approach of validating python path when debugging (#2808)