Geoprocessing service fails via widget but works from IDLE (ArcGIS Server Python 2.7)

354
1
03-16-2022 12:00 PM
Sysniper
New Contributor

Hello,

I have published a custom python script tool via ArcGIS Pro to Portal. After publishing, I've made some changes to the python file on our server (i.e. found in this location: arcgisserver\directories\arcgissystem\arcgisinput\<TOOL NAME>.GPServer\extracted\...\script.py).

If I sign in to the server I can successfully run the script on the server via IDLE (ArcGIS Server Python 2.7). Running it in this way, it works exactly as I'd like. However, if I edit and run with IDLE (ArcGIS Server), I get a Traceback error which, amongst other things, includes the following message:

AttributeError: module 'arcpy' has no attribute 'mapping'

I get the same error when I run via a geoprocessing widget in a web mapping application. (Note that the geoprocessing widget is the final location for this tool to work).

I guess this means the geoprocessing widget runs with whichever version of Python and/or arcpy is used by the 'ArcGIS Server' IDLE. 

I realize one solution is to re-write the script to fit this other syntax, something like this, but I'd rather not do that.

Is there any way I can set my run my geoprocessing widget to use the 'ArcGIS Server Python 2.7' setup so that I don't need to change my script?

Our current install on the server is 10.9.1.

0 Kudos
1 Reply
DavidPike
MVP Frequent Contributor

possibly heading 'Specify a Python environment for a single geoprocessing service'

Deploying custom Python packages for ArcGIS Server—ArcGIS Server | Documentation for ArcGIS Enterpri...