Debugging Python 3.x with Visual Studio Code on OSX

OSX comes with Python 2.x by default, and setting the default Python version to 3.x is not without trouble. Here is how you debug Python 3.x applications with Visual Studio Code and the Python extension.

  1. Open the application folder in VS Code
  2. Create a new launch configuration based on the Python template
  3. Add "pythonPath": "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3" to the configuration so that it looks similar to the following:
{
    "name": "Python",
    "type": "python",
    "request": "launch",
    "pythonPath": "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3",
    "stopOnEntry": true,
    "program": "${file}",
    "debugOptions": [
        "WaitOnAbnormalExit",
        "WaitOnNormalExit",
        "RedirectOutput"
    ]
}

And start debugging!