<?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: Python Toolbox / regular Toolbox -- postExecute not working in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333996#M68793</link>
    <description>&lt;P&gt;Yes that is the code, but have you added the toolbox to your project and tried to execute it?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="toolboxes2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82044i4137E2A608DEFFF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="toolboxes2.png" alt="toolboxes2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Catalog, Project tab, Toolboxes with my toolbox which has a tool with a toolset and a tool shown&lt;/P&gt;&lt;P&gt;which you can launch and run to test whether it works or check its properties&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="toolboxes3.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82045i67EA3210EDF1B2AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="toolboxes3.png" alt="toolboxes3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;for tool validation... (postExecute is commented out here since none is needed)&lt;/P&gt;</description>
    <pubDate>Sun, 01 Oct 2023 19:56:39 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2023-10-01T19:56:39Z</dc:date>
    <item>
      <title>Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333990#M68790</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;I am dealing with unable to use postExecute method within Python Toolbox or atbx toolbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool(object‌‌
    def __init__(self‌‌):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Tool"
        self.description = ""
        self.canRunInBackground = False

    def getParameterInfo(self‌‌):
        """Define parameter definitions"""

        param1 = arcpy.Parameter(
            displayName="Dos",
            name="param1",
            datatype="DEFeatureClass",
            parameterType="Required",
            direction="Input")

        param2 = arcpy.Parameter(
                displayName="Output Features",
                name="out_features",
                datatype="GPFeatureLayer",
                parameterType="Derived",
                direction="Output")
           
        return [param1, param2]
   
    def execute(self, parameters, messages‌‌):
        """The source code of the tool."""

        param1 = parameters[0].valueAsText
        gdb  = "gdb_path"
        out =  f"{gdb}/layer2"

        arcpy.CopyFeatures_management(param1, out)

        arcpy.SetParameter(1, out)
        arcpy.AddMessage("Tool has finished executing222")
        return

    def postExecute(self, parameters, messages‌‌):
        """This method takes place after outputs are processed and
        added to the display."""
        arcpy.AddMessage("Tool has finished executing!!!!!!!!!!!!!!!!!!!!")
        try:
            project = arcpy.mp.ArcGISProject('CURRENT')
            active_map = project.activeMap
           
            if active_map:
                out_layer = active_map.listLayers(os.path.basename(self.params[1].valueAsText))[0]
               
                symbology = out_layer.symbology
                symbology.updateRenderer('SimpleRenderer')
                symbology.renderer.symbol.applySymbolFromGallery('Airport')
                symbology.renderer.symbol.size = 12
                out_layer.symbology = symbology
               
        except Exception:
            pass

        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used example from documentation, has anyone had any success with using postExecute?&lt;/P&gt;&lt;P&gt;Do I need to execute it someway?&lt;/P&gt;&lt;P&gt;Code is basic, just for testing purpose.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Yanu&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 16:53:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333990#M68790</guid>
      <dc:creator>Yanu</dc:creator>
      <dc:date>2023-10-01T16:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333991#M68791</link>
      <description>&lt;P&gt;What does the toolbox look like?&amp;nbsp; That is where you execute the tool from within your project's toolbox&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 18:01:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333991#M68791</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-10-01T18:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333992#M68792</link>
      <description>&lt;P&gt;Toolbox is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os

class Toolbox(object):
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "Toolbox"
        self.alias = "toolbox"

        # List of tool classes associated with this toolbox
        self.tools = [Tool]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Default, postExecute is also from documentation.&lt;BR /&gt;&lt;BR /&gt;They suggested using postExecute:&lt;BR /&gt;here&amp;nbsp;&lt;A href="https://support.esri.com/en-us/bug/a-custom-python-script-tool-for-apply-symbology-from-la-bug-000155515" target="_blank" rel="noopener"&gt;Bug with symbology&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 18:27:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333992#M68792</guid>
      <dc:creator>Yanu</dc:creator>
      <dc:date>2023-10-01T18:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333996#M68793</link>
      <description>&lt;P&gt;Yes that is the code, but have you added the toolbox to your project and tried to execute it?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="toolboxes2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82044i4137E2A608DEFFF0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="toolboxes2.png" alt="toolboxes2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Catalog, Project tab, Toolboxes with my toolbox which has a tool with a toolset and a tool shown&lt;/P&gt;&lt;P&gt;which you can launch and run to test whether it works or check its properties&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="toolboxes3.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82045i67EA3210EDF1B2AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="toolboxes3.png" alt="toolboxes3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;for tool validation... (postExecute is commented out here since none is needed)&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 19:56:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333996#M68793</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-10-01T19:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333997#M68794</link>
      <description>&lt;P&gt;Thank you for your reply Dan.&lt;BR /&gt;&lt;BR /&gt;Yes, I've added this Python Toolbox to project.&lt;/P&gt;&lt;P&gt;I tried also setting up ATBX from scartch and testing if postExecute will run.&lt;BR /&gt;&lt;BR /&gt;Nothing happens...&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 19:59:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1333997#M68794</guid>
      <dc:creator>Yanu</dc:creator>
      <dc:date>2023-10-01T19:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334002#M68795</link>
      <description>&lt;P&gt;postExecute is new. Are you using ArcGIS Pro 3.x?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 20:51:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334002#M68795</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2023-10-01T20:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334003#M68796</link>
      <description>&lt;P&gt;I know, I am using 3.1.1.&lt;BR /&gt;I've checked patch notes, 0 bugs...&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 20:54:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334003#M68796</guid>
      <dc:creator>Yanu</dc:creator>
      <dc:date>2023-10-01T20:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334014#M68797</link>
      <description>&lt;P&gt;Which leaves the thread you posted&amp;nbsp;&lt;A href="https://support.esri.com/en-us/bug/a-custom-python-script-tool-for-apply-symbology-from-la-bug-000155515" target="_blank"&gt;BUG-000155515 for ArcGIS Pro (esri.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so I would open an Issue with Tech Support so they can investigate why it isn't working.... I don't use postExecute in my toolboxes&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 22:19:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1334014#M68797</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-10-01T22:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1458668#M70576</link>
      <description>&lt;P&gt;Hi Yanu, Dan and Luke&lt;BR /&gt;I'm using ArcGIS Pro 3.3 and have same problems with "postExecute" routine.&lt;BR /&gt;It seems do nothing.&lt;BR /&gt;Any news from the BUGS?&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 15:30:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1458668#M70576</guid>
      <dc:creator>FrancescaCella</dc:creator>
      <dc:date>2024-05-13T15:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox / regular Toolbox -- postExecute not working</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1464818#M70581</link>
      <description>&lt;P&gt;&lt;A href="https://support.esri.com/en-us/bug/a-custom-python-script-tool-for-apply-symbology-from-la-bug-000155515" target="_blank"&gt;BUG-000155515 for ArcGIS Pro (esri.com)&lt;/A&gt;&amp;nbsp; still lists the status as "known limitation"&lt;/P&gt;&lt;P&gt;so contacting Tech Support would be your best option&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 07:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-regular-toolbox-postexecute-not/m-p/1464818#M70581</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-05-14T07:51:01Z</dc:date>
    </item>
  </channel>
</rss>

