I am using a code (modified from Midavalo) to save .shp files as .lry files. The code runs well and displays the .lr files in the table of Contents. However, the Python displays Runtime error. On the other hand, I don’t know how to save .lyr I need the .lyr files to export as .kml files
import arcpy
from arcpy import env
env.workspace = r"D:\ss3\polygons"
buf= r"D:\ss3\polygons\001.shp"
ou2= r"D:\ss3\layers\001.lyr"
arcpy.MakeFeatureLayer_management(buf, 'buf_layer')
arcpy.SaveToLayerFile_management('buf_layer', ou2, "ABSOLUTE")
This the error:
Runtime error Traceback (most recent call last): File "", line 7, in File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\management.py", line 6965, in MakeFeatureLayer raise e ExecuteError: ERROR 000732: Input Features: Dataset D:\ss3\polygons\001.shp does not exist or is not supported