Python debugging in Visual Studio Code


(Andras Lasso) #1

Visual Studio Code is an awesome source code editor and IDE - free, multi-platform (Windows, Linux, and Mac), and highly extensible.

Support has been added in recent versions of Slicer to connect from Visual Studio Code to Slicer’s embedded Python interpreter and add breakpoints, inspect variables, run the code step-by-step, etc. See more information and setup instructions here.

(Gstarbuck) #2

Has anyone been able to get this work with Slicer 4.8.1 and the current VSCode? I am not able to. I follow the steps exactly and Slicer just keeps hanging, vscode starts and then stops the debugger and gives no output.

One thing that’s different is that I get a warning in vscode in the launch.json file, it says, “Property secret is not allowed”. Am I supposed to somehow specify a different Python interpreter or something?

There doesn’t seem to be any online help for slicer/vscode, and I don’t want to have to install Eclipse just for this. Thanks!

(Andras Lasso) #3

Slicee-4.8 is more than a year old! Latest VS Code uses new version of Python debugger libraries that are incompatible with old versions.

You need to use at least Slicer-4.10 with recent VS Code releases.