10

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

9

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...

2
  • Thanks, a quick help found here Jul 7, 2022 at 11:30
  • super quick and easy solution! Feb 6 at 7:58
6

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

3
  • It says "Please first open a folder in order to do advanced debug configuration"
    – xorg
    May 13, 2020 at 8:24
  • 1
    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 May 13, 2020 at 8:42
  • 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.
    – xorg
    May 13, 2020 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.