<?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: Layer to KML works in Python window but not in Script tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105698#M8138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I tossed this into a script tool with the script imported. The TBX is zipped and attached above. The output location will be a folder called 'export' in your scratch folder. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Mar 2020 15:03:58 GMT</pubDate>
    <dc:creator>ZacharyHart</dc:creator>
    <dc:date>2020-03-30T15:03:58Z</dc:date>
    <item>
      <title>Layer to KML works in Python window but not in Script tool [Update: Bug]</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105694#M8134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcGIS Pro 2.5&lt;/P&gt;&lt;P&gt;The Layer to KML GP Tool from the standard TBX works fine.&lt;/P&gt;&lt;P&gt;The ArcPy code will work in the Python window.&lt;/P&gt;&lt;P&gt;The ArcPy code will even run and produce the KMZ from an IDE (such as Spyder).&lt;/P&gt;&lt;P&gt;The ArcPY code completes without error when run as a Script Tool in Pro, but no output is produced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone else test this? I'm losing my mind trying to figure this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\JackTorrance\Documents\ArcGIS\scratch\export\ExportTestAgain333.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ExportedFeaturesLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ExportedFeaturesLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerToKML_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ExportedFeaturesLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"D:\\TEMP\\TryThis.kmz"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I added the message simply to ensure the feature layer was valid (contains features), and you can see this working as expected in the GP messaging dialog.&lt;/P&gt;&lt;P&gt;One other observation: the script tool takes way longer than it should, like 2.5 minutes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105694#M8134</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2021-12-11T06:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105695#M8135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;script tool ... as in a script attached to a tool in a toolbox?&lt;/P&gt;&lt;P&gt;what are the parameters you have specified?&lt;/P&gt;&lt;P&gt;Conventional script tools require that the parameters be specified as input, derived or output.&lt;/P&gt;&lt;P&gt;The code you have posted seems to be that used in an IDE which should work there as you have found&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Mar 2020 13:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105695#M8135</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-28T13:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105696#M8136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;I dumbed th code way down for purpose of isolation. No parameters set in the script tool for this test. I have tried a number of different input types and output locations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Humor me and toss that in a script tool and let me know if it works for you. This may be a bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Mar 2020 13:26:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105696#M8136</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2020-03-28T13:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105697#M8137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/05/19/toolbox-creation-in-arcgis-pro"&gt;/blogs/dan_patterson/2016/05/19/toolbox-creation-in-arcgis-pro&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would have to rewrite your code to specify your hardcoded paths to work in a conventional python tool&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Mar 2020 13:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105697#M8137</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-28T13:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105698#M8138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I tossed this into a script tool with the script imported. The TBX is zipped and attached above. The output location will be a folder called 'export' in your scratch folder. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:03:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105698#M8138</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2020-03-30T15:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool [Update: Bug]</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105699#M8139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From Support Services:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;We finished the testing and confirmed and attached the following defect to your case:&lt;BR /&gt; &lt;BR /&gt; BUG-000129805 : Running the python command for &amp;nbsp;Layer to KML works in idle, but fails to create output if run from script tool.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Lame. We are in the process of updating all of our existing GP services to Pro/Python 3.x based tools. This roadblocks updating one of our most used GP widgets which will now have to remain ArcMap/Python 2.x based for the foreseeable future. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2020 13:26:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/105699#M8139</guid>
      <dc:creator>ZacharyHart</dc:creator>
      <dc:date>2020-04-02T13:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool [Update: Bug]</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/1312189#M68252</link>
      <description>&lt;P&gt;Has anyone had luck with this since the original post?&amp;nbsp; I'm experiencing the exact same issue, using Pro 2.9.5 and a colleague is seeing the same thing with Pro 3.&lt;/P&gt;&lt;P&gt;Trying to add the Layer to KML tool into a custom GP tool (modifying the Data Extract script tool to add KML and JSON export options) and the script will run successfully and create a zipped folder, but the tool doesn't run, the zipped folder is empty, and it throws a warning saying that I need the Data Interoperability extension.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jfischer91_0-1690390326124.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/76378i5BB5F820978A5AAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jfischer91_0-1690390326124.png" alt="jfischer91_0-1690390326124.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jfischer91_1-1690390363649.png" style="width: 626px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/76381i3148515179438520/image-dimensions/626x61?v=v2" width="626" height="61" role="button" title="jfischer91_1-1690390363649.png" alt="jfischer91_1-1690390363649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 18:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/1312189#M68252</guid>
      <dc:creator>jfischer91</dc:creator>
      <dc:date>2023-07-26T18:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Layer to KML works in Python window but not in Script tool [Update: Bug]</title>
      <link>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/1312269#M68256</link>
      <description>&lt;P&gt;We were able to remedy this by changing the configuration in the pick list of the format type parameters.&amp;nbsp; I had the quotes set up wrong; things are working now that they are set up as below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jfischer91_2-1690402104157.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/76432i8C2D2FD1118F3837/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jfischer91_2-1690402104157.png" alt="jfischer91_2-1690402104157.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 20:08:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-to-kml-works-in-python-window-but-not-in/m-p/1312269#M68256</guid>
      <dc:creator>jfischer91</dc:creator>
      <dc:date>2023-07-26T20:08:35Z</dc:date>
    </item>
  </channel>
</rss>

