My geoprocessing service is failing with the errors:
ExecuteError: ERROR 999999: Error executing function.
An event was unable to invoke any of the subscribers [Execute error]
Bad syntax in request. (status code 400).
And here's the script that is being called. p0 is the derived output raster and p1 is the input raster.
def function(p0, p1):
import arcpy
import os
from arcpy.sa import *
scratchFolder = arcpy.env.scratchFolder
arcpy.AddMessage('arcpy.env.scratchFolder: ' + arcpy.env.scratchFolder)
arcpy.AddMessage(str(p1))
output = os.path.join(scratchFolder, "output.tif")
arcpy.AddMessage(output)
Fill(p1).save(output)
arcpy.SetParameter(0, output)
return
I'm running ArcGIS Server 10.6 on Windows Server 2016 and the geoprocessing service was published from ArcGIS Desktop 10.6 on my PC running Windows 7. The server does not have ArcGIS desktop installed on it and never did.
Initially I thought it was a Spatial Analyst licencing problem but if I swap the offending Fill(p1).save(output) line with Negate(p1).save(output), with Negate being another SA tool, then it works fine and so the licence is ok. FlowDirection also fails in the same way as Fill.
The tool runs fine on ArcGIS Desktop on my PC. This is a simplified version of my tool to illustrate the error more clearly.
Here's the complete output messages from the script in case that helps:
Server Messages
Submitted.
Executing...
Executing (SA test): SATest d:\arcgis\arcgisserver\directories\arcgisjobs\satest_gpserver\j08d619f38d944d2a8df0cfae9a06d975\scratch\Input_raster.tif
Start Time: Tue Apr 3 09:24:09 2018
Executing (SATest): SATest d:\arcgis\arcgisserver\directories\arcgisjobs\satest_gpserver\j08d619f38d944d2a8df0cfae9a06d975\scratch\Input_raster.tif
Start Time: Tue Apr 3 09:24:09 2018
Running script SATest...
arcpy.env.scratchFolder: d:\arcgis\arcgisserver\directories\arcgisjobs\satest_gpserver\j08d619f38d944d2a8df0cfae9a06d975\scratch
d:\arcgis\arcgisserver\directories\arcgisjobs\satest_gpserver\j08d619f38d944d2a8df0cfae9a06d975\scratch\Input_raster.tif
d:\arcgis\arcgisserver\directories\arcgisjobs\satest_gpserver\j08d619f38d944d2a8df0cfae9a06d975\scratch\output.tif
Traceback (most recent call last):
File "<string>", line 97, in execute
File "C:\python27\ArcGISx6410.6\lib\site-packages\LUCItools\wstools\wst_sa_test.py", line 13, in function
Fill(p1).save(output)
File "c:\program files\arcgis\server\arcpy\arcpy\sa\Functions.py", line 2289, in Fill
z_limit)
File "c:\program files\arcgis\server\arcpy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "c:\program files\arcgis\server\arcpy\arcpy\sa\Functions.py", line 2285, in Wrapper
z_limit)
File "c:\program files\arcgis\server\arcpy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
An event was unable to invoke any of the subscribers [Execute error]
Bad syntax in request. (status code 400).
Failed to execute (Fill).
Failed to execute (SATest).
Failed at Tue Apr 3 09:24:09 2018 (Elapsed Time: 0.37 seconds)
Failed to execute (SA test).
Failed at Tue Apr 3 09:24:09 2018 (Elapsed Time: 0.40 seconds)
Failed.
Thanks in advance!