agolservices.FindRoutes not working? (Messages say "Successful", but output won't save)

08-29-2023 01:55 PM
New Contributor III

Hello, I am trying to loop through two layers (stops and barriers), and select from each using a common ID. Once the appropriate stops and barriers are selected, I would like to run the Find Routes tool using AGOL's routing service. I am prepared to have the script use credits and I have ensured I have enough, so the issue is not related to that as far as I know.

I am importing the Route module like so: 

gis = GIS("Pro") # I am logged into my organization through ArcGIS Pro 

route_service = ";World/Route;"


I then loop through everything using the following code: 


# Create stops layer

## Create bridge barriers
arcpy.analysis.Buffer(bridges, barriers, "10 Meters", "FULL", "ROUND", "NONE")

bridge_list = [55, 37, 12]
for b in bridge_list:
    # Select relevant stops and barriers for routes
    barrier_query = """"ORIG_FID" = {}""".format(b)
    stops_query = """Bridge_OID = '{}'""".format(b)"barriers_lyr", "NEW_SELECTION", barrier_query)"stops_lyr", "NEW_SELECTION", stops_query)
    # Run Route tool
    result = arcpy.agolservices.FindRoutes("stops_lyr", "Minutes", "NorthAmerica", Return_to_Start=True,
                                            Polygon_Barriers = "barriers_lyr", Use_Hierarchy=True, Travel_Mode="Custom",                                                    Output_Format="Feature Set")



The above results in the following error: 


RuntimeError: ResultObject: Error in getting output


My credit usage is not going down so I don't think the tool is even running. When I call results.status, I get "4" as a result, and the messages all say that it was a success. 

0 Kudos
2 Replies
New Contributor III

Any luck at getting this figured out, I am having similar issues with using the 

0 Kudos
New Contributor III

Hi, sorry for the delay in responding! I guess I don't get notifications. I ended up using


I input my network and points, etc, then:


result ="Route", "SKIP", "TERMINATE", None, '') 



Then, to access the routes layer, I looped through `result` like this: 


if result.status == 4:
    for x in result.getOutput(0).listLayers():
        if == "Routes":
            [analyze route here]



I hope this helps! 


0 Kudos