skip to Main Content

When I execute a Python file in VSCode, the path of the executed file is supposed to be between double quotes, but for me it’s not. I am able to execute the file by manually inserting the double quotes into the command.

(i think this could help: all this happened to me after i installed a c++ compiler [MSYS2]).

I’ve tried

  • Opening a new VSCode window.
  • Running other files.

2

Answers


    1. Check File Association Settings in VS Code:

    Open Visual Studio Code.
    Go to the "Settings" (you can press Ctrl + , on Windows/Linux or Cmd + , on macOS).
    Search for "file associations" or "files.associations" in the search bar.
    Look for Python file associations and ensure that they are configured correctly.

    2.Check Python Path Configuration:

    Verify that Python is properly configured in your system’s environment variables. Ensure that the path to Python does not contain any conflicting characters or spaces.
    In VS Code, use the command palette (Ctrl + Shift + P or Cmd + Shift + P) and type "Python: Select Interpreter" to ensure that the correct Python interpreter is selected.

    1. Reset Default Settings in VS Code:

    If the issue persists, you can try resetting Visual Studio Code to its default settings.
    Go to "File" > "Preferences" > "Settings".
    Click on the three dots in the upper-right corner and select "Reset Settings" or "Reset to Defaults".

    1. Reinstall or Update Extensions:

    Consider reinstalling or updating any extensions related to Python or file handling in Visual Studio Code.

    1. Check MSYS2 Installation and Configuration:

    Verify that the installation of MSYS2 didn’t inadvertently change any environment variables or system configurations that could affect how VS Code handles file paths.
    Ensure that MSYS2 installation paths or settings are not conflicting with Python or VS Code.

    Login or Signup to reply.
  1. Please use the official expansion Python executing script, which will not appear the double quotes you said.

    https://code.visualstudio.com/docs/python/python-tutorial

    enter image description here

    If you think it is a problem caused by extension, you can use the following methods to find extensions and disable.

    https://code.visualstudio.com/blogs/2021/02/16/extension-bisect

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