<?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: Script tool not creating output, but works in Python Window in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070058#M61404</link>
    <description>&lt;P&gt;perhaps package a gdb with the toolbox located in the same path location as the toolbox, which is easier to locate&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jun 2021 22:06:10 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-06-18T22:06:10Z</dc:date>
    <item>
      <title>Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1069906#M61393</link>
      <description>&lt;P&gt;I have a simple script that works perfectly fine in the python window in Pro. However when I import the script to a tool, the process fails on the first geoprocess line. I don't understand why this is happening or why running from a tool differs from the python window in this case. I attached a screen shot of the script. Any response is really appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 17:04:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1069906#M61393</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T17:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1069924#M61394</link>
      <description>&lt;P&gt;It fails on the first line since the script tool has no clue what the aprx is.&lt;/P&gt;&lt;P&gt;Your import statements need to be at the top of the script before any of your required definitions of variables.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 18:00:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1069924#M61394</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-18T18:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070019#M61397</link>
      <description>&lt;P&gt;Thanks for the reply Dan. I do have aprx defined, but I accidentally didn't include in screenshot. Here is the full script. I still have the same issue where the spatial join is not happening.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 21:06:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070019#M61397</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T21:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070031#M61398</link>
      <description>&lt;P&gt;Correction, the spatial join&amp;nbsp;&lt;EM&gt;is&amp;nbsp;&lt;/EM&gt;happening it's just not being added to the map. I'll try to figure this out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 21:23:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070031#M61398</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T21:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070032#M61399</link>
      <description>&lt;P&gt;What is the error message Chris?&lt;/P&gt;&lt;P&gt;I am used to conventional tools that require that you define your parameters in the parameter dialog.&amp;nbsp; The first line of the script would indicate instant failure since the tool wouldn't have a clue what "CURRENT" is but would require a path to an aprx.&lt;/P&gt;&lt;P&gt;Perhaps the error message would help to separate out the issue.&amp;nbsp; I can see it working within pros' python window or pros' notebooks, but not as a conventional tool or a script tool (unless you have the parameters defined in the tools' script)&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 21:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070032#M61399</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-18T21:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070035#M61400</link>
      <description>&lt;P&gt;makefeaturelayer .... needs to be added to the script... alternately, add it after&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 21:26:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070035#M61400</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-18T21:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070049#M61402</link>
      <description>&lt;P&gt;Currently there is no error message. It produces an excel of the spatialJoin table but it skips the select by attributes part because the join layer is not added to the map. If I add the lines below it, it adds to map and makes the right excel export. But I need to find out how to make that work if I send the tool to someone else.. The path to the layer for makefeaturelayer has to be a parameter set by the user maybe..&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr =
arcpy.management.MakeFeatureLayer(r"Path_to_Layer\\DropFiber_SpatialJoin", "DropFiber_SpatialJoin").getOutput(0)

maps.addLayer(lyr, 'TOP')&lt;/LI-CODE&gt;&lt;P&gt;Again, thanks for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 21:57:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070049#M61402</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T21:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070056#M61403</link>
      <description>&lt;P&gt;I believe I fixed my imports as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 22:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070056#M61403</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T22:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070058#M61404</link>
      <description>&lt;P&gt;perhaps package a gdb with the toolbox located in the same path location as the toolbox, which is easier to locate&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 22:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070058#M61404</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-18T22:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070063#M61406</link>
      <description>&lt;P&gt;It worked when I added the following lines -&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;workspace = a.env.workspace

lyr = arcpy.management.MakeFeatureLayer(workspace+"\\DropFiber_SpatialJoin", "DropFiber_SpatialJoin").getOutput(0)

maps.addLayer(lyr, 'TOP')&lt;/LI-CODE&gt;&lt;P&gt;I have the workspace a parameter that the user sets before running the tool. This way the tool should work for co workers I send to. Fingers crossed!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 22:18:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070063#M61406</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-06-18T22:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool not creating output, but works in Python Window</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070131#M61410</link>
      <description>&lt;P&gt;Please don't post code as screenshots.&amp;nbsp;&lt;A href="https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552" target="_blank"&gt;https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 04:28:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-not-creating-output-but-works-in/m-p/1070131#M61410</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-06-19T04:28:04Z</dc:date>
    </item>
  </channel>
</rss>

