skip to Main Content

When I’m trying to run my main.py file through VSCode terminal, it works fine if i use py main.py but shows the prompt of "how do you want to open this file?" when i use python command instead of py.

this issue is specific to vs code terminal. both py and python works fine on my windows terminal.

here’s what i tried-

  1. selected interpreter path
  2. multiple reinstallations of python and vscode
  3. checked system env path-> all set well
  4. checked aliases
  5. doskey python=py

what am i missing here?

2

Answers


  1. Try to create a folder and use IDLE to create a file and run that file in VS Code.

    Login or Signup to reply.
  2. In the command line try: python3 path/to/file/main.py
    You can get the correct relative path to your file by right clicking on the file in VSCode and selecting ‘Copy relative path’.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search