VSCode — How can I change the run configuration?

Question:

I am working with a single python file. The first time I launched it, VSCode prompted me to choose a run configuration, and I accidentally chose Module instead of Python File. Now every time I click Run I get the error python.exe: No module named enter-your-module-name.

I want to just change the run config to run as a normal python file.

I didn’t have a folder opened, just this single file. In my searches for how to fix this I saw people say "delete your launch.json file", but I don’t have one. What can I do?

Asked By: Ryan Steffer

||

Answers:

You can click Run Python File in the running options in the upper right corner.

enter image description here

The situation you described seems to use the debug mode incorrectly. You can delete launch.json in the .vscode folder on the left workspcae.

enter image description here

You can alse set in the Run and Debug button.

enter image description here

or it may look like it:

enter image description here

Answered By: MingJie-MSFT
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.