19

I am a new programmer that started learning Python, but there's something bothering me which I'd like to change.

As I've seen that it is possible to remove the unwanted path from the terminal when executing code, I cannot figure out how to access the Visual Studio Code launch.json file and all of the explanations on Google are quite confusing.

2 Answers 2

17

Note that if Visual Studio Code hasn't created a launch.json file for your project yet, do the following:

  • Click the Run | Add Configuration menu option, and one will automatically be generated for you, and opened in the editor.

NOTE: You have to have a "Folder" open, for this to work. File | Open Folder...

Sign up to request clarification or add additional context in comments.

1 Comment

super quick and easy solution!
8

In Visual Studio Code, use shortcut Ctrl + Shift + P to open the Command Palette and type Open launch.json. And it will open the launch.json file for you. If you also can't open launch.json then try the way below.

Check if the .vscode folder exists in the root folder. If not, then create a new one and create file launch.json in that. Now you have launch.json for your workspace and you can configure your project.

Enter image description here

4 Comments

It says "Please first open a folder in order to do advanced debug configuration"
Check if .vscode folder exists in the root folder. If not, then create a new one and create launch.json in that. Now you have launch.json for your workspace and you can config your project
I managed to open launch.json but I think I opened it as Java and not python. In case you're wondering, I'm trying to remove that unwanted path on the terminal everytime I run a python file.
I tried ctrl-shift-p then "open launch.json", but it opens settings.json instead. An error badge appears on the tiny bell at bottom right, and the message is "Configuration 'Python Debugger: Python File' is missing in 'launch.json'." I can't find an option to create a launch.json file, and now I can't run Python in VSCode. (Note, not because of this; I already wrecked it earlier. I wanted to pass arguments in the IDE instead of having to edit the main code file. Where would the root folder be? I have no idea. I'm trying to learn how to set up a project.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.