AnsweredAssumed Answered

Fill causes syntax error in parsing grid expression when run in background

Question asked by p261080_RUG on Mar 16, 2017
Latest reply on Apr 7, 2017 by xander_bakker

I'm trying to use in a python toolbox command, however it always fails with the following error:

Executing: FillFailTest C:\proef\mv_gron
Start Time: Fri Apr 07 10:19:57 2017
Running script FillFailTest...

Workspace was C:\Users\jelmer\Documents\ArcGIS\Default.gdb
Workspace is C:\WorkSpace

Traceback (most recent call last):
File "<string>", line 34, in execute
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\sa\", line 2089, in Fill
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\sa\", line 53, in swapper
result = wrapper(*args, **kwargs)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\sa\", line 2085, in Wrapper
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing\", line 513, in _callback
return val(*gp_fixargs(args, True))
ExecuteError: ERROR 010328: Syntax error at or near symbol ).
ERROR 010267: Syntax error in parsing grid expression.
Failed to execute (Fill).

Failed to execute (FillFailTest).
Failed at Fri Apr 07 10:19:59 2017 (Elapsed Time: 1,45 seconds)

The odd thing is, the fill command works fine if I run it from the embedded arcpy console:

from import Raster
from import Fill
x = Raster(r'C:\test\mv_gron')
y = Fill(x, 40)

(Updated) To test Shaun's solution, I've also added these lines:

arcpy.env.workspace = r"C:\WorkSpace"
arcpy.env.scratchWorkspace = r"C:\WorkSpace"

It also works fine when I set the canRunInBackground property of the tool to False. Is there a way to run the too with the Fill call in the background?


I've attached a small toolbox example that fails for me.


(Update 2) I'm starting to doubt whether it has something to do with canRunInBackground or not. Currently, the Fill tool and only work when used directly in ArcMap. If I call in a python toolbox from inside ArcMap, or from IDLE, I encounter the syntax error. All paths are already short and simple, except for the install location of ArcMap (which is in the default C:\Program Files (x86)\Ar..etc).