0

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

3
  • 2
    Please include the error message in your question.
    – artwork21
    Commented May 18, 2018 at 17:24
  • This the error: Runtime error Traceback (most recent call last): File "<string>", line 7, in <module> 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 Commented May 18, 2018 at 18:30
  • Don't forget to take the Tour to learn about our focussed Q&A format.
    – PolyGeo
    Commented May 19, 2018 at 5:15

1 Answer 1

2

The error suggests your path is incorrect or the shapefile does not exist in this directory:

buf = r"D:\ss3\polygons\001.shp"

At the minium to make a shapefile you need a .dbf, .shx, and .shp file in the same directory.

2
  • Now with your advice, I fixed the error. Commented May 18, 2018 at 21:32
  • @SebastianSalazar if the answer was that helpful then I think you should upvote it (like I just did) and click the green checkmark to Accept the answer.
    – PolyGeo
    Commented May 19, 2018 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.