Iterating Create KML Script

Discussion created by dmarkey on Nov 10, 2011
Latest reply on Nov 16, 2011 by dmarkey

I am attempting to convert a number of layer files to KML/KMZ. The script below is what I have so far. The output component is where the error occurs, something about an invalid file type.

# Import system modules
import arcpy
from arcpy import env

# Obtain a license for the 3D Analyst extension

# Set environment settings
env.workspace = "C:\\data"
Location = "C:\\data\\"

for layer in arcpy.ListFiles("*.lyr"):
    arcpy.LayerToKML_conversion(layer, Location + kmz, "10000", "false", "Default", "1024", "96")