Friday, November 30, 2018

Debug into python system libraries in Visual Studio Code

By default, vscode does not let you to debug into python system libraries. If errors or exceptions happen in system libraries, you will only see the errors at the place you call the system library. Even if you set break points in system libraries, when it stops, it will stop at the place you call the system library. And the stack trace only shows the stack up to the call to system library. This can be very inconvenient sometimes. Fortunately, this behavior can be changed by setting "debugStdLib" to true in the launch configuration (can be opened through Menu->Debug->Open Configurations) like the following:

"configurations": [
{
    "name": "Python: Current File (Integrated Terminal)",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "debugStdLib": true,
},

No comments: