Search code examples
vscode-debugger

vscode not starting debugger (flask)


This is new behavior, but I don't know what I changed (if anything), although I'm not sure what the Date below indicates as I didn't take any action to update vscode.

I've been using vscode just fine to debug my flask applications for over a year. Today when I tried to start a new debug session, nothing happens. This means there's no flask process set in the Run and Debug window, and no Python debug terminal started.

The Date might be consistent with when things stopped working for me, though, as I was trying to start debugging with a different repo than I'd been working with.

UPDATE: downgrade to 1.68.1 did not resolve the problem.

Version: 1.69.0 (user setup)
Commit: 92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9
Date: 2022-07-07T05:28:36.503Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19043

I looked at https://github.com/microsoft/vscode/wiki/Terminal-Issues#creating-great-terminal-issues and started tracing using code --log trace. I think this is the relevant trace logs.

[2022-07-08 11:49:18.223] [renderer1] [trace] CommandService#executeCommand workbench.action.debug.start
[2022-07-08 11:49:18.262] [renderer1] [trace] Error while resolving configuration file 'vscode-userdata:/c%3A/Users/lking/AppData/Roaming/Code/User/tasks.json': Unable to read file 'vscode-userdata:/c:/Users/lking/AppData/Roaming/Code/User/tasks.json' (Error: Unable to resolve nonexistent file 'vscode-userdata:/c:/Users/lking/AppData/Roaming/Code/User/tasks.json')
[2022-07-08 11:49:18.273] [renderer1] [trace] Error while resolving configuration file 'file:///c%3A/Users/lking/Documents/Lou%27s%20Software/projects/rrwebapp/rrwebapp/.vscode/tasks.json': Unable to read file 'c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\.vscode\tasks.json' (Error: Unable to resolve nonexistent file 'c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\.vscode\tasks.json')
[2022-07-08 11:49:18.373] [renderer1] [trace] onWillActivateByEvent:  onDebugResolve
[2022-07-08 11:49:18.373] [renderer1] [trace] onWillActivateByEvent:  onDebugResolve:python
[2022-07-08 11:49:18.696] [renderer1] [trace] [History stack global-default]: notifyNavigation() (editor: log:rendererLog, event: edit)
[2022-07-08 11:49:18.697] [renderer1] [trace] [History stack global-default]: notifyNavigation() not ignoring (editor: log:rendererLog, event: edit)
[2022-07-08 11:49:18.697] [renderer1] [trace] [History stack global-default]: onSelectionAwareEditorNavigation() (editor: log:rendererLog, event: edit)
[2022-07-08 11:49:18.697] [renderer1] [trace] [History stack global-default]: replace() (editor: log:rendererLog, event: <none>)
[2022-07-08 11:49:18.698] [renderer1] [trace] [History stack global-default]: index: 1, navigating: false
- group: 0, editor: file:///c%3A/Users/lking/Documents/Lou%27s%20Software/projects/rrwebapp/rrwebapp/.vscode/launch.json, selection: line: 28-28, col:  22-22
- group: 0, editor: log:rendererLog, selection: line: 1-1, col:  1-1

I've confirmed tasks.json doesn't exist in either folder, but checking crashplan (my backup system) I don't think this has existed, at least not recently.

I hope someone has some ideas, as I'm stymied.

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Flask",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "justMyCode": false,
            "env": {
                "FLASK_APP": "run.py",
                // normally development, production for test of applogging
                "FLASK_ENV": "development"
            },
            "args": [
                "run",
                "--no-debugger"
            ],
            "jinja": true,
            // "cwd": "${workspaceFolder}/.."
        },
        {
            "name": "Launch Chrome",
            "request": "launch",
            "type": "chrome",
            "url": "http://dev.localhost:5000",
            // "webRoot": "${workspaceFolder}"
            "webRoot": "${workspaceFolder}/rrwebapp"
        },
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false,
        },
        {
            "name": "Python: Celery",
            "type": "python",
            "request": "launch",
            "module": "celery",
            "console": "integratedTerminal",
            "env": {
                // https://github.com/celery/celery/issues/4081#issuecomment-349535810
                "FORKED_BY_MULTIPROCESSING": "1"
            },
            "args": [
                "-A",
                "rrwebapp.celery",
                "worker",
                "-c2",
                "-l",
                "info",
                "-n",
                "celery@localhost",
                // may not be needed, see https://stackoverflow.com/a/54488640/799921 and https://github.com/Microsoft/ptvsd/issues/1046
                // "-P",
                // "solo",
            ]
        },
        {
            "name": "Python: Celery longtask (results analysis)",
            "type": "python",
            "request": "launch",
            "module": "celery",
            "console": "integratedTerminal",
            "env": {
                // https://github.com/celery/celery/issues/4081#issuecomment-349535810
                "FORKED_BY_MULTIPROCESSING": "1"
            },
            "args": [
                "-A",
                "rrwebapp.celery",
                "worker",
                "-c2",
                "-l",
                "info",
                "-Q",
                "longtask",
                "-n",
                "celerylongtask@localhost",
                // may not be needed, see https://stackoverflow.com/a/54488640/799921 and https://github.com/Microsoft/ptvsd/issues/1046
                // "-P",
                // "solo",
            ]
        },
    ]
}

Solution

  • FWIW, when I downgraded the Python extension to v2022.8.1, the problem is resolved

    I saw the following in the log file C:\Users\lking\AppData\Roaming\Code\logs\20220708T145527\exthost1\output_logging_20220708T145531\3-Python.log added whenever I tried to start the flask debugging session.

    DAP Server launched with command: c:\Users\lking\Documents\Lou's Software\projects\rrwebapp\rrwebapp\venv\Scripts\python.exe c:\Users\lking\.vscode\extensions\ms-python.python-2022.10.0\pythonFiles\lib\python\debugpy\adapter
    

    And the files in that directory were from 2022-07-08 01:03, which was my clue