Select to view content in your preferred language

Error Running Generate Service Areas Tool

593
2
04-16-2021 08:44 AM
by Anonymous User
Not applicable

I created a custom geoprocessing tool in arcpy in ArcGIS Pro. In this I use the Generate Service Areas tool. This works as expected in Pro, but when I upload to an ArcGIS Server and try to run it in a web app in AGOL it fails. Here is a snippet of code from the script:

 

tbx = "https://logistics.arcgis.com/arcgis/services;World/ServiceAreas;username;password"

arcpy.ImportToolbox(tbx)

arcpy.AddToolbox(tbx)
result = arcpy.GenerateServiceAreas_ServiceAreas(facilities, breakValues, breakUnits)

while result.status < 4:

    time.sleep(1)
result_severity = result.maxSeverity

if result_severity == 2:

    arcpy.AddError("An error occured when running the tool")
    
    arcpy.AddError(result.getMessages(2))

    sys.exit(2)

elif result_severity == 1:

    arcpy.AddWarning("Warnings were returned when running the tool")
    
    arcpy.AddWarning(result.getMessages(1))
result.getOutput(0).save(serviceArea)

 

Any ideas on what could cause this to fail or a workaround? 

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

Is that the exact code used in both environments?

What was the error message?

AddToolbox and ImportToolbox are the same

AddToolbox—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
Max_Zeng
New Contributor

Hi, I am trying to understand more about your workflow. Do you want to run GenerateServiceAreas from your enterprise, which points to GenerateServiceAreas in ArcGIS Online? If that's the case, you can refer to this documentation to configure route utility service on your portal, to use ArcGIS Online routing services. 

0 Kudos