This question already has an answer here:
I have code that doesn't work at the moment:
# Import arcpy module import arcpy # Script arguments Input = arcpy.GetParameterAsText(0) if Input == '#' or not Input: Input = "frame" # provide a default value if unspecified Symbology = arcpy.GetParameterAsText(1) if Symbology == '#' or not Symbology: Symbology = "symbology" # provide a default value if unspecified mxd = arcpy.mapping.MapDocument("C:\\temp\\Untitled.mxd") df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] addLayer = arcpy.mapping.Layer("C:\\temp\\test.shp") arcpy.mapping.AddLayer(df, addLayer) ### Local variables: Rearrange = Symbology line_connection_shp = Rearrange ### Process: Apply Symbology From Layer arcpy.ApplySymbologyFromLayer_management(Input, Symbology) Process: Points To Line arcpy.PointsToLine_management(Rearrange, line_connection_shp, "MMSI", "", "NO_CLOSE") What this is doing is creating an .mxd, placing my test.shp into the .mxd, and then simply connecting relative points and applying my layer symbology (a .lyr file) to a shapefile.
This results in an error:
ERROR 000732: Input Layer: Dataset C:\temp\test.shp does not exist or is not supported. It works fine when I apply these tools myself, but creates errors while using it in Python. Thanks for the help.
أكثر...
I have code that doesn't work at the moment:
# Import arcpy module import arcpy # Script arguments Input = arcpy.GetParameterAsText(0) if Input == '#' or not Input: Input = "frame" # provide a default value if unspecified Symbology = arcpy.GetParameterAsText(1) if Symbology == '#' or not Symbology: Symbology = "symbology" # provide a default value if unspecified mxd = arcpy.mapping.MapDocument("C:\\temp\\Untitled.mxd") df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] addLayer = arcpy.mapping.Layer("C:\\temp\\test.shp") arcpy.mapping.AddLayer(df, addLayer) ### Local variables: Rearrange = Symbology line_connection_shp = Rearrange ### Process: Apply Symbology From Layer arcpy.ApplySymbologyFromLayer_management(Input, Symbology) Process: Points To Line arcpy.PointsToLine_management(Rearrange, line_connection_shp, "MMSI", "", "NO_CLOSE") What this is doing is creating an .mxd, placing my test.shp into the .mxd, and then simply connecting relative points and applying my layer symbology (a .lyr file) to a shapefile.
This results in an error:
ERROR 000732: Input Layer: Dataset C:\temp\test.shp does not exist or is not supported. It works fine when I apply these tools myself, but creates errors while using it in Python. Thanks for the help.
أكثر...