Select to view content in your preferred language

Error executing tool. GP Server Script Tool Fails

05-04-2023 07:53 AM
New Contributor II

I have created a python script to automate the output of several maps that are created weekly.

For the past year it has worked without any problems, and now it seems that for some reason it is not working properly.
The script is uploaded to ArcGIS Server (version 10.9.1), locally and through ArcGIS Pro (3.0.3 version), the script runs and works correctly.

However, when I run the script from REST on the server, I get the following error:

Error executing tool. Script Job ID: ja80780b469e54e149b0c59cf5b8fa0f6 : Traceback (most recent call last): File "D:\arcgisserver\directories\arcgissystem\arcgisinput\WNV\WNV_MapOutput.GPServer\extracted\p20\script\", line 14, in <module> aprx = + '/' + 'WNV_WeeklyMaps' + '/' + 'WNF_Maps.aprx') File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\", line 346, in __init__ self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True)) OSError: // Failed to execute (Script).


Any idea how to fix it?
I've changed the script several times, the paths and I've also resubbed it, and it still doesn't work.

Attached is a screenshot with part of the code




0 Kudos
2 Replies
New Contributor III

Did you ever find out a solution? I am having the same issue as well.


aprx_path = os.environ["APRX_PATH"]
arcpy.AddMessage('APRX_PATH: {}'.format(aprx_path))
if os.path.exists(aprx_path):
    arcpy.AddMessage('aprx_path exists')
    arcpy.AddMessage('aprx_path DNE')
aprx =


In my case I have verified that the path exists when run from a service, and it is still giving me an OSError, despite working fine when I run manually in Pro (3.1).

0 Kudos
New Contributor II

No, sorry, I haven't found a solution yet, but after a lot of testing, it seems that there is an incompatibility issue between the version of ArcGIS Pro I have installed (3.0) and the server version (version 10.9.1).

Some Esri colleagues  have told me that the best solution is to upgrade the server I have from enterprise to version 11.
On the other hand, I have tested on a virtual machine with ArcGIS Pro version 2.9 and my current server with version 10.9.1 and it works. So, it seems to be the problem. However, I don't want to run an older version of ArcGIS Pro as I have done projects with version 3.
I hope this helps.