Search code examples
pythonvisual-studio-codedebuggingwindows-10

How can I reenable the warning about unsupported Python version by VS Code debugger


I'm using Visual Studio Code 1.78.0 and version v2023.8.0 of the Python extension on Windows 10. When I tried to debug an old project requiring Python 2.7.13 (provided by a virtual environment), I got a warning saying The debugger in the python extension no longer supports python version minor than 3.7. I selected Do not show again in the dialog and switched to an older version of the extension.

Now I would like that dialog to show again, but can't find a setting to do that. How can I reenable the warning?


Solution

  • The general settings in vscode exist in the user or workspace settings.json, and there is also a database file state.vscdb in vscode.

    The settings.json file stores information about user settings, such as preferences and keybindings. This file is a plain text JSON file that can be opened and edited by clicking the Settings icon in the left sidebar.

    The state.vscdb file is an SQLite database file that contains metadata and state information for all files that VSCode has open in the workspace, such as file path, encoding, and open/closed status.

    When Do not show again is clicked, neither the user nor the workspace settings.json changes, since such settings are stored in state.vscdb.

    enter image description here

    solution

    1. You can install SQLiteStudio to open the state.vscdb file (On my machine it exists at the following path).

      C:\Users\Administrator\AppData\Roaming\Code\User\globalStorage
      

      Before editing the state.vscdb file, you need to close vscode first.

    2. Open the state.vscdb file in SQLiteStudio and select the Data tab on the right

      enter image description here

    3. Scroll down to find the record whose key is ms-python.python

      --> Double-click its value

      --> Select the Text tab in the pop-up panel

      --> scroll to the end

      --> remove the last ,"doNotShowPython36DebugDeprecatedAgain":true

      --> click OK

      enter image description here

    4. Click commit to submit changes

      enter image description here

      After submitting, you can click the blue refresh button and check whether the ms-python.python value has changed.

    5. Open vscode at this time, and the prompt box will pop up again when using python 2.7.13 to debug the script.

    Special Note: Please make sure that vscode is closed when performing the above operations.