I want to find the shortest path between two points. I first make a route layer from an analysis network and then add two point locations. While python shows the following errors when I use the solve function. Can anyone tell me the reason? ExecuteError: Failed to execute. Parameters are not valid. ERROR 000824: The tool is not licensed. Failed to execute (Solve).
Code works when I use Python window in ArcMap and I actually have all ArcGIS licenses
codes: '''
import arcpy
import os
arcpy.env.workspace = r"C:\Users\hyan1\Desktop\try\network\network_for_wageningen.mdb"
network = r'C:\Users\hyan1\Desktop\try\network\network_for_wageningen.mdb\network2_ND'
outNALayer = arcpy.na.MakeRouteLayer(network, "WorkRoute", "length")
outNALayer = outNALayer.getOutput(0)
subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
points_layername = subLayerNames["Stops"]
routes_layername = subLayerNames["Routes"]
### add location, solve and export
input_point = r'C:\\Users\hyan1\Desktop\Route_2\T11_1_11_pro_lyr_1.shp'
output_name = os.path.split(input_point)[1]
arcpy.na.AddLocations(outNALayer, points_layername, input_point, "", "", "DateTimeS")
arcpy.na.Solve(outNALayer)
arcpy.FeatureClassToFeatureClass_conversion("WorkRoute\Routes", r"C:\Users\hyan1\Desktop\Route_2\shortest_route", output_name)
'''