I am using the following code to make a Closest Facility layer, which I then want to output the CFRoutes table to use in a SearchCursor: import arcpy, os, sys from arcpy import env arcpy.env.workspace = "C:\\Users\\Ant\\Documents\\ArcGIS\\ITN.gdb" arcpy.RefreshCatalog("C:\\Users\\Ant\\Documents\\ArcGIS\\ITN.gdb") env.overwriteOutput = True inNetworkDataset = "C:\Users\Ant\Documents\ArcGIS\OSMaster.gdb\ITN_Network\ITN_NetworkDataset" impedanceAttribute = "Drive" searchTolerance = "5000 Meters" accumulateAttributeName = ["Length", "Drive"] inFacilities = "TL_chemistsV3" inIncidents = "BLPUs_Points" outLayerFile = "ProxChemistsCF.lyr" outNALayer = arcpy.na.MakeClosestFacilityLayer(inNetworkDataset, "ProxChemistsCF", impedanceAttribute, "TRAVEL_TO", "", 1, accumulateAttributeName, "NO_UTURNS", "", "", "", "TRUE_LINES_WITHOUT_MEASURES") outNALayer = outNALayer.getOutput(0) subLayerNames = arcpy.na.GetNAClassNames(outNALayer) facilitiesLayerName = subLayerNames["Facilities"] incidentsLayerName = subLayerNames["Incidents"] arcpy.na.AddLocations(outNALayer, facilitiesLayerName, inFacilities, "", searchTolerance) arcpy.na.AddLocations(outNALayer, incidentsLayerName, inIncidents, "", searchTolerance) arcpy.na.Solve(outNALayer) tableName = subLayerNames["CFRoutes"] if arcpy.Exists("ProxChemists"): arcpy.Delete_management("ProxChemists") outTable = "ProxChemists" arcpy.CopyRows_management(tableName, outTable)but the last line fails with error message: ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Rows: Dataset Routes does not exist or is not supported Failed to execute (CopyRows).
But the dataset I am inputting is CFRoutes, not Routes as per this line tableName = subLayerNames["CFRoutes"]I tried skipping the CopyRows and jumping straight into the search cursor using this: with arcpy.da.UpdateCursor("BLPUs", ["FID", "ChemistsFID", "ChemistsDist", "ChemistsDrive"]) as cursor: for row in cursor: OID1 = str(int(row[0])) searchrows = arcpy.da.SearchCursor(tableName, ["ObjectID", "FacilityID", "Total_Drive", "Total_Length"]) for searchrow in searchrows: searchrow1 = str(int(searchrow[0])) searchrow2 = str(int(searchrow[1])) searchrow3 = str(float(searchrow[2])) searchrow4 = str(float(searchrow[3])) if searchrow1 == OID1: row[1] = searchrow2 row[2] = searchrow4 row[3] = searchrow3 cursor.updateRow(row)But the error is 'RuntimeError: cannot open 'Routes''So I guess calling CFRoutes tries to open the sub-table Routes intentionally but is failing, have I missed something out? Is the Closest Facility layer not actually being created?