0

The only thing I need is an exact copy of an existing shapefile in the same directory with a different name.

I have tried:

arcpy.CopyFeatures_management (ORLinks, MyLinks) #ORLinks: old links, MyLinks: new links

but for some reason, I cant make it a feature layer using:

arcpy.MakeFeatureLayer_management(MyLinks, 'MyLinks')

Error Encountered:

Error: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset 
M:\RAIL\Rail2.0.shp does not exist or is not supported
Failed to execute (MakeFeatureLayer).
3

To do this I would use Copy instead of CopyFeatures because it:

Makes a copy of the input data.

The code that you presented does not have enough detail to be certain what went wrong with it but a test like below works without error:

import arcpy
arcpy.env.workspace = r"C:\Temp"
arcpy.Copy_management("test.shp","test2.shp")
arcpy.MakeFeatureLayer_management("test2.shp","test2")

If you are using a shapefile named Rail2.0.shp then I would recommend renaming it to something with only one period like rail2.shp.

2
  • 2
    I suspect the problem is that MyLinks (the variable) is set to 'Rail2.0.shp' or 'M:\RAIL\Rail2.0.shp', depending on workspace settings.. shapefiles don't like punctuation in their names, the '.0.shp' will cause some tools to fail. You are right though, there's not enough information in the question to be certain of what's going wrong. – Michael Stimson Mar 4 '18 at 22:05
  • Yes, renaming the shapefile to 'Rail2.shp' solved the problem. – pnkjmndhl Mar 4 '18 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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