Install previous versions of the Python Debugger extension in VSCode.
How to debug Python 3.6 in VSCode?
gdb - Python extension debugging - Stack Overflow
VS Code Python debugger would not start with Python extension 2022.Xx.xx although latest 2021 (2021.12.1559732655) works. Starting regular run works - Stack Overflow
Videos
My Python debugger is broken (I am using Python 3.6, I can't change it because this isn't my project) since it only supports Python 3.7+. "The debugger in the python extension no longer supports python versions minor than 3.7."
I've heard that debugpy exists and theoretically supports Python 3.6, but I have no idea how to use it (how is it different from the base Python Debugger in vscode). I currently have Python Debugger v2024.0.0 installed, and its description is "Python Debugger extension using 'debugpy'" but it won't let me debug my Python 3.6 code. I tried installing an older version, but when I navigate to that option, it only shows me 2024.0.0 (current) and no other options. Seeing other people do it (with other extensions at least), they have hundreds of options, from like every single month.
I have no idea what to do, I don't use extensions besides the debugger so I have no idea what's going on. I turned off auto-updates and set it to manual, but I haven't been able to fix it.
Has anyone been able to debug Python 3.6 in VSCode, and if so, how?
For source debugging to work, your C extensions must be built with debug info (gcc -g). Since you're driving the compilation process with distutils, you can specify the compiler flags used through the CFLAGS environment variable (Installing Python Modules: Tweaking compiler/linker flags):
CFLAGS='-Wall -O0 -g' python setup.py build
Note that even if distutils defaults to a higher optimization level than -O0, you really shouldn't get that No symbol "node" in current context error as long as -g is passed and most Python builds do pass -g by default.
The problem is the optimization. I'm not sure how to do it from the command line, but in the setup.py script I just added extra_compile_args=['-O0'], to the Extension constructor and everything worked.
Would still like (and would accept) an answer that involved a command line arg (something after python setup.py build) that would accomplish the same thing so I don't have to have a compiler specific line in my setup.py file.
Seems that I got my answer on ghithub. The debugger will not work with versions lower than Python 3.7.
For anything other than Python 3.7+ (like Python 2.6 ) use the 2021.12 version of the vs code python extension.
https://github.com/microsoft/vscode-python/issues/19559#issuecomment-1358494296
Using Visual Studio Code:
Version: 1.86.2 (user setup)
Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
Date: 2024-02-13T19:40:56.878Z
Electron: 27.2.3
ElectronBuildId: 26908389
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.22621
I solved this issue by creating a "launch.json" file in a ".vscode" folder, in the project folder (https://code.visualstudio.com/docs/python/debugging). Without this file, the debugger didn't start. Using previous versions of VS Code, I was able to start a debugger without "launch.json" file, but not now. After creating the file, the python debugger started ok.