I am simply trying to create a selection of a street layer from street names that appear within a separate .dbf of street names and create individual layers of each selection with a for loop. Everything works until the last step where I use the object to serve as the path string for the resulting layer.
Is this not allowed in arcpy.SaveToLayerFile_management? I have looked everywhere for the answer. I have also tried both \ and / within the pathname and with/without an "r" in front of the pathname. Here is the latest version of the code:
import arcpyimport sys, osarcpy.env.overwriteOutput = Truearcpy.env.workspace = os.path.join(os.path.dirname(sys.argv[0]), 'Test.gdb')rows = arcpy.SearchCursor("COR_Length_Sum_Greater_Half_Mile")arcpy.MakeFeatureLayer_management("COR_Maintained", "CORlyr")for row in rows: street = row.getValue("Display_Street") expression = "Display_Street" + " " + "=" + " " + '\'' + str(street) + '\'' lyrName = street.replace(" ", "_") arcpy.MakeFeatureLayer_management("COR_Maintained", lyrName, expression) outLayer = "r" + '\"' + "A:\\" + "StreetMaintenance\GIS\Justin Castrati" + "\\" + lyrName + '\"' arcpy.SaveToLayerFile_management(lyrName, outLayer)
أكثر...
Is this not allowed in arcpy.SaveToLayerFile_management? I have looked everywhere for the answer. I have also tried both \ and / within the pathname and with/without an "r" in front of the pathname. Here is the latest version of the code:
import arcpyimport sys, osarcpy.env.overwriteOutput = Truearcpy.env.workspace = os.path.join(os.path.dirname(sys.argv[0]), 'Test.gdb')rows = arcpy.SearchCursor("COR_Length_Sum_Greater_Half_Mile")arcpy.MakeFeatureLayer_management("COR_Maintained", "CORlyr")for row in rows: street = row.getValue("Display_Street") expression = "Display_Street" + " " + "=" + " " + '\'' + str(street) + '\'' lyrName = street.replace(" ", "_") arcpy.MakeFeatureLayer_management("COR_Maintained", lyrName, expression) outLayer = "r" + '\"' + "A:\\" + "StreetMaintenance\GIS\Justin Castrati" + "\\" + lyrName + '\"' arcpy.SaveToLayerFile_management(lyrName, outLayer)
أكثر...