Using the geoprocessing tool, "Layer To KML" within a python script tool and ArcGIS Pro v2.9.2 crashes without warning, or error(s). If the tool is used outside of the script tool, there is no problem and KMZ is created as expected. No screen shots available but my code is as follows:
arcpy.LayerToKML_conversion(out_layer, "MergedShape.kmz")
Seems straight forward enough but crashes everytime.
Hi @JamesShively, I'm unable to reproduce your crash, although I might be doing something different from you. Here's the script I'm using for the tool execution:
import os
import arcpy
in_lyr = arcpy.GetParameterAsText(0)
out_kmz_path = arcpy.GetParameterAsText(1)
out_kmz_name = arcpy.GetParameterAsText(2)
out_kmz = os.path.join(
out_kmz_path,
out_kmz_name if out_kmz_name.endswith(".kmz") else f"{out_kmz_name}.kmz"
)
def execute(in_lyr, out_kmz_path):
res = arcpy.conversion.LayerToKML(in_lyr, out_kmz)
return res
output = execute(in_lyr, out_kmz_path)
arcpy.SetParameter(3, output)
And for the script tool are set up like this:
I tried it in 2.9 and 2.9.2