<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't get Visual Studio 2017 to attach to ArcGIS Pro to debug Python toolbox in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389988#M30822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For anyone else looking for this - the answer is in the help page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/get-started/debugging-python-code.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/get-started/debugging-python-code.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.9994rem; margin: -145px 0px 1.55rem; padding-top: 175px;"&gt;Debug Python toolboxes&lt;/H2&gt;&lt;P style="color: #4c4c4c; background-color: #ffffff; margin-bottom: 1.55rem;"&gt;IDEs can only debug Python files (&lt;SPAN class=""&gt;.py&lt;/SPAN&gt;). For code in a Python toolbox (&lt;SPAN class=""&gt;.pyt&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file), copy the code to an external Python file, and replace the code in the Python toolbox with the example below. You can then open the Python file in your IDE and set breakpoints, attach the IDE to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;ArcGIS Pro&lt;/SPAN&gt;, and use your Python toolbox. Upon completion of code modification, copy the contents of the Python file back into the Python toolbox.&lt;/P&gt;&lt;DIV class=""&gt;&lt;P style="margin-bottom: 1.55rem;"&gt;In the following example, pyt_code.py contains the code usually found in the Python toolbox and is saved to the same directory as a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;.pyt&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE style="margin-bottom: 1.55rem;"&gt;&lt;CODE class="" style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.85em;"&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;from&lt;/SPAN&gt; pyt_code &lt;SPAN class="" style="color: #aa0d91;"&gt;import&lt;/SPAN&gt; *&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The section at the top is a bit misleading as it says&amp;nbsp;&lt;/P&gt;&lt;H3 style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.69949rem; margin: 0px 0px 1.55rem;"&gt;Microsoft Visual Studio IDE&lt;/H3&gt;&lt;H4 class="" style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.414rem; margin: 0px 0px 1.55rem;"&gt;&lt;/H4&gt;&lt;DIV class="" style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;TABLE style="background-color: #ffffff; border: 1px solid #cccccc; font-size: 0.875rem; margin-bottom: 1.55rem;"&gt;&lt;THEAD style="background-color: #efefef; border-bottom: 1px solid #cccccc; font-size: 1rem;"&gt;&lt;TR style="border-bottom: none;"&gt;&lt;TH colspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;Debugging method&lt;/TH&gt;&lt;TH colspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;Attach to running processes&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY class=""&gt;&lt;TR class="" style="border-bottom: 1px solid #cccccc;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;P&gt;Supported&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;ArcGIS Pro&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;components&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;UL style="font-size: 0.9375rem; margin-left: 0.775rem; margin-bottom: 1.55rem;"&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Script tools execution&lt;/LI&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Script tool validation&lt;/LI&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Python toolboxes&lt;/LI&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;so it really should link to the bottom of the page.&lt;/P&gt;&lt;P&gt;Anyway works as expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Jun 2019 00:14:29 GMT</pubDate>
    <dc:creator>FraserHand1</dc:creator>
    <dc:date>2019-06-26T00:14:29Z</dc:date>
    <item>
      <title>Can't get Visual Studio 2017 to attach to ArcGIS Pro to debug Python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389986#M30820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created a Python toolbox using the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/creating-tools/a-template-for-python-toolboxes.htm"&gt;Python toolbox template&lt;/A&gt;. I've configured Visual Studio 2017 to recognize .pyt files as Python files. I've used the instructions &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-desktop/analytics/how-to-debug-python-toolboxes-in-3-easy-steps/"&gt;here&lt;/A&gt; to set up debugging for my Python toolbox.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To debug, I attach the Visual Studio debugger to the ArcGISPro.exe process as Python code, as shown in the screen shot below. I've set breakpoints in my code. However, when I run a tool from the toolbox, none of the breakpoints are hit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/438050_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any insight as to why I can't debug?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Visual Studio 2017&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.2&lt;/P&gt;&lt;P&gt;Python 3.6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2019 14:56:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389986#M30820</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2019-02-25T14:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get Visual Studio 2017 to attach to ArcGIS Pro to debug Python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389987#M30821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Did you ever work this out?&lt;/P&gt;&lt;P&gt;It does work if you add a class and debug in there - so it seems to be that VS doesn't recognise the .pyt as a python file for the debugger. I tried adding it through the registry but had little success. Did you get a solution?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Fraser&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2019 02:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389987#M30821</guid>
      <dc:creator>FraserHand1</dc:creator>
      <dc:date>2019-06-06T02:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get Visual Studio 2017 to attach to ArcGIS Pro to debug Python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389988#M30822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For anyone else looking for this - the answer is in the help page:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/get-started/debugging-python-code.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/get-started/debugging-python-code.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.9994rem; margin: -145px 0px 1.55rem; padding-top: 175px;"&gt;Debug Python toolboxes&lt;/H2&gt;&lt;P style="color: #4c4c4c; background-color: #ffffff; margin-bottom: 1.55rem;"&gt;IDEs can only debug Python files (&lt;SPAN class=""&gt;.py&lt;/SPAN&gt;). For code in a Python toolbox (&lt;SPAN class=""&gt;.pyt&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file), copy the code to an external Python file, and replace the code in the Python toolbox with the example below. You can then open the Python file in your IDE and set breakpoints, attach the IDE to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;ArcGIS Pro&lt;/SPAN&gt;, and use your Python toolbox. Upon completion of code modification, copy the contents of the Python file back into the Python toolbox.&lt;/P&gt;&lt;DIV class=""&gt;&lt;P style="margin-bottom: 1.55rem;"&gt;In the following example, pyt_code.py contains the code usually found in the Python toolbox and is saved to the same directory as a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;.pyt&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE style="margin-bottom: 1.55rem;"&gt;&lt;CODE class="" style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.85em;"&gt;&lt;SPAN class="" style="color: #aa0d91;"&gt;from&lt;/SPAN&gt; pyt_code &lt;SPAN class="" style="color: #aa0d91;"&gt;import&lt;/SPAN&gt; *&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The section at the top is a bit misleading as it says&amp;nbsp;&lt;/P&gt;&lt;H3 style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.69949rem; margin: 0px 0px 1.55rem;"&gt;Microsoft Visual Studio IDE&lt;/H3&gt;&lt;H4 class="" style="color: #4c4c4c; background-color: #ffffff; font-weight: 300; font-size: 1.414rem; margin: 0px 0px 1.55rem;"&gt;&lt;/H4&gt;&lt;DIV class="" style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;TABLE style="background-color: #ffffff; border: 1px solid #cccccc; font-size: 0.875rem; margin-bottom: 1.55rem;"&gt;&lt;THEAD style="background-color: #efefef; border-bottom: 1px solid #cccccc; font-size: 1rem;"&gt;&lt;TR style="border-bottom: none;"&gt;&lt;TH colspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;Debugging method&lt;/TH&gt;&lt;TH colspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;Attach to running processes&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY class=""&gt;&lt;TR class="" style="border-bottom: 1px solid #cccccc;"&gt;&lt;TD colspan="1" rowspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;P&gt;Supported&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;ArcGIS Pro&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;components&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.51667rem;"&gt;&lt;UL style="font-size: 0.9375rem; margin-left: 0.775rem; margin-bottom: 1.55rem;"&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Script tools execution&lt;/LI&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Script tool validation&lt;/LI&gt;&lt;LI style="margin: 0.3875rem 0px 0.3875rem 1.5rem;"&gt;Python toolboxes&lt;/LI&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;so it really should link to the bottom of the page.&lt;/P&gt;&lt;P&gt;Anyway works as expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2019 00:14:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-get-visual-studio-2017-to-attach-to-arcgis/m-p/389988#M30822</guid>
      <dc:creator>FraserHand1</dc:creator>
      <dc:date>2019-06-26T00:14:29Z</dc:date>
    </item>
  </channel>
</rss>

