AnsweredAssumed Answered

ERROR 000732: Layer: File does not exist or is not supported (ArcPy)

Question asked by GriffinWilliams11 on Nov 20, 2017
Latest reply on Nov 20, 2017 by mitchh300

Hello GeoNet community, 

 

I am attempting to do some (basic) processing using ArcPy to speed up a workflow. Essentially, I have a ~100 shapefiles of property boundaries that I need to convert to .kml so that they can be visualized in Google Earth.

 

When I run the code which is pasted below I get ERROR 000732: Layer: File does not exist or is not supported. However, when I try to export one shapefile to .kml individually it exports successfully, when done in ArcGIS. (please note that if the statement "print file" is inserted after the "if. file.endswith('boudnary.shp')" the desired files are printed)

 

Thank you in advance for your time and energy, any comments and/or suggestions are greatly appreciated.

 

 

import os
import arcpy

kmz_out = r"Z:/outPath"



for dirpath, dirnames, filenames in os.walk(r"Z:/inPath"):
    for file in filenames:
        if file.endswith('boundary.shp'):
            arcpy.LayerToKML_conversion(layer="file",
                                        out_kmz_file="kmz_out",
                                        layer_output_scale="0", is_composite="NO_COMPOSITE",
                                        boundary_box_extent="DEFAULT", image_size="1024", dpi_of_client="96",
                                        ignore_zvalue="CLAMPED_TO_GROUND")
            print "boundary has been made"

Outcomes