<?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 Debugging python tools issue in 3.3 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544685#M72971</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before 3.3, I was able to debug Python geoprocessing tools. For development, I use Visual Studio 2022, but I was still unable to debug the scripts there. The workaround was to use Visual Studio 2019 by attaching the Pro process to it.&lt;/P&gt;&lt;P&gt;However, after migrating to version 3.3, that workaround no longer works.&lt;/P&gt;&lt;P&gt;Can anyone guide me on how to debug Python scripts for geoprocessing tools in version 3.3, or suggest any new workarounds?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/458875"&gt;@AlfredBaldenweck&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/607017"&gt;@HaydenWelch&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2024 12:13:15 GMT</pubDate>
    <dc:creator>CarlosK</dc:creator>
    <dc:date>2024-10-02T12:13:15Z</dc:date>
    <item>
      <title>Debugging python tools issue in 3.3</title>
      <link>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544685#M72971</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before 3.3, I was able to debug Python geoprocessing tools. For development, I use Visual Studio 2022, but I was still unable to debug the scripts there. The workaround was to use Visual Studio 2019 by attaching the Pro process to it.&lt;/P&gt;&lt;P&gt;However, after migrating to version 3.3, that workaround no longer works.&lt;/P&gt;&lt;P&gt;Can anyone guide me on how to debug Python scripts for geoprocessing tools in version 3.3, or suggest any new workarounds?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/458875"&gt;@AlfredBaldenweck&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/607017"&gt;@HaydenWelch&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 12:13:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544685#M72971</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-10-02T12:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging python tools issue in 3.3</title>
      <link>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544698#M72972</link>
      <description>&lt;P&gt;for reference, you are saying the information below no longer works?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/debugging-python-code.htm" target="_blank"&gt;Debug Python code—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 12:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544698#M72972</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-10-02T12:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging python tools issue in 3.3</title>
      <link>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544869#M72976</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp; Yes. But anyways previously as well it was not working, had to use a VS 2022 for development but for debugging I was using VS 2019. But now after migrating to Pro 3.3 even the workaround of debugging using VS 2019 is also not working.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 17:44:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1544869#M72976</guid>
      <dc:creator>CarlosK</dc:creator>
      <dc:date>2024-10-02T17:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging python tools issue in 3.3</title>
      <link>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1547662#M73009</link>
      <description>&lt;P&gt;I don't use Visual Studio much because I find it to be a bit overbearing for Python development and prefer VS Code for my style of programming.&lt;/P&gt;&lt;P&gt;For debugging, I usually just shadow the print function using this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def print(*values: object,
          sep: str = " ",
          end: str = "\n",
          file = None,
          flush: bool = False,
          severity: Literal['INFO', 'WARNING', 'ERROR'] = None):
    """ Print a message to the ArcGIS Pro message queue and stdout
    set severity to 'WARNING' or 'ERROR' to print to the ArcGIS Pro message queue with the appropriate severity
    """
    # Import the builtins module for the standard print function
    import builtins

    # Print the message to stdout
    builtins.print(*values, sep=sep, end=end, file=file, flush=flush)
    
    end = "" if end == '\n' else end
    message = f"{sep.join(map(str, values))}{end}"
    # Print the message to the ArcGIS Pro message queue with the appropriate severity
    match severity:
        case "WARNING":
            arcpy.AddWarning(f"{message}")
        case "ERROR":
            arcpy.AddError(f"{message}")
        case _:
            arcpy.AddMessage(f"{message}")
    return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That will let you use the standard print function to print to the message box when you run a tool from Pro. You can also just use standard breakpoints and such from VS Code if your script doesn't rely on the PYT system.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 17:07:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/debugging-python-tools-issue-in-3-3/m-p/1547662#M73009</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-10-10T17:07:31Z</dc:date>
    </item>
  </channel>
</rss>

