AnsweredAssumed Answered

LayerToKML script execution error ERROR 000210

Question asked by ahmadabusaleh on Sep 10, 2020
Latest reply on Sep 10, 2020 by danretired

I am trying to write a very simple script that exports a layer to KMZ file using LayerToKML GP tool.


import arcpy


p =
mp = p.listMaps()[0]

for lyr in mp.listLayers():
                print (

                arcpy.conversion.LayerToKML(lyr,out, 0, "NO_COMPOSITE", "DEFAULT", 1024, 96, "CLAMPED_TO_GROUND")


the Data source is file FGDB and Pro map has only one layer with 10 lines features ( the data is very simple) 

the script executed locally on my C drive, but I keep getting this error


arcgisscripting.ExecuteError: ERROR 000210: Cannot create output C:\Users\<USER>\AppData\Local\Temp\{74AB2B10-C6A1-4D89-AB64-FE6CE55D17FE}.lyrx
Failed to execute (LayerToKML).


I checked my local temp folder and I have full Read and Write permissions. my question is why I am getting this error, and why the tool is trying to export the lyrx to the temp folder? 


I tired to set arcpy.env.workspace to point to the project location but it didnt nothing.

I am using ArcGIS Pro 2.5