# Python debugging in Visual Studio 2019

**URL:** <https://discourse.slicer.org/t/python-debugging-in-visual-studio-2019/15369>\
**Category:** Development\
**Tags:** python\
**Created:** [January 6, 2021, 6:16am UTC](https://discourse.slicer.org/t/python-debugging-in-visual-studio-2019/15369 "2021-01-06T06:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stephan/32/2444_2.png) [@stephan](https://discourse.slicer.org/u/stephan)\
**Post date:** [January 6, 2021, 6:16am UTC](https://discourse.slicer.org/t/python-debugging-in-visual-studio-2019/15369/1 "2021-01-06T06:16:30Z")

</div>

Hi,

has anyone managed to attach the Visual Studio 2019 (community edition) debugger to Slicer’s python? I installed the Slicer DebuggingTools extension and followed the steps in the extension’s [documentation](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/DebuggingTools#Debugging_in_VisualStudio) for attaching SlicerPython to the Visual Studio _2017_ debugger, but this seems to no longer apply to the 2019 version. There is no connection type “Python remote (ptvsd)”, just “Python remote (debugpy)”, but when I choose that one and input the target “tcp://slicer@localhost:5678” , it fails with an error message I don’t really understand (see screenshot) when I click “Find…”

 ![grafik](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/a/3a3a835235339b68131df232fa3aa02e72eee854.png)

Has someone run into this problem before? Any advice would be greatly appreciated.

Thank you very much.  
Stephan

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 6, 2021, 3:45pm UTC](https://discourse.slicer.org/t/python-debugging-in-visual-studio-2019/15369/2 "2021-01-06T15:45:15Z")

</div>

Port Selector is not implemented (not necessary) for the Python debugger. See more information here: [https://github.com/Microsoft/PTVS/issues/1390#issuecomment-229479669](https://github.com/Microsoft/PTVS/issues/1390#issuecomment-229479669)

I’ve tried Visual Studio’s Python debugger about a year ago and it worked OK then. Visual Studio code is quite similar in capability. I usually use PyCharm because it can automatically reconnect when I restart Slicer, which is a huge convenience (you need the “professional” version, which you get for free if you are a student or have a university email address).

---

<div class="post-metadata">

**Author:** ![stephan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stephan/32/2444_2.png) [@stephan](https://discourse.slicer.org/u/stephan)\
**Post date:** [January 7, 2021, 7:39pm UTC](https://discourse.slicer.org/t/python-debugging-in-visual-studio-2019/15369/3 "2021-01-07T19:39:50Z")

</div>

Thank you very much, I will give it another try soon. Otherwise I’ll install PyCharm.
