AnsweredAssumed Answered

Layer to KML works in Python window but not in Script tool [Update: Bug]

Question asked by LANDVEST on Mar 27, 2020
Latest reply on Apr 2, 2020 by LANDVEST

ArcGIS Pro 2.5

The Layer to KML GP Tool from the standard TBX works fine.

The ArcPy code will work in the Python window.

The ArcPy code will even run and produce the KMZ from an IDE (such as Spyder).

The ArcPY code completes without error when run as a Script Tool in Pro, but no output is produced.


Can anyone else test this? I'm losing my mind trying to figure this out.


import arcpy

arcpy.env.overwriteOutput = True

arcpy.MakeFeatureLayer_management(r"C:\Users\JackTorrance\Documents\ArcGIS\scratch\export\ExportTestAgain333.shp", "ExportedFeaturesLayer")
arcpy.LayerToKML_conversion("ExportedFeaturesLayer", "D:\\TEMP\\TryThis.kmz")

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.

One other observation: the script tool takes way longer than it should, like 2.5 minutes!