Trouble executing Fill in arcpy

by William   Last Updated September 11, 2019 22:22 PM

I am having trouble using Fill in arcpy as part of a tool. It works fine as a script, but when I create a tool, it fails. To localize the problem I modified the Help stand-alone script associated with Fill. I also tried creating a blank raster outFill before the Fill command, but with similar results.

# Name: Fill_Ex_02.py
# Description: Fills sinks in a surface raster.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

inSurfaceRaster = arcpy.GetParameterAsText(0)

# Set local variables
zLimit = 3.28

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute FlowDirection
outFill = Fill(inSurfaceRaster, zLimit)

# Save the output 
outFill.save("C:/sapyexamples/output/TestFilled.tif")
~~~~~~~~~~

The error message is:
Traceback (most recent call last):
  File "C:\Users\William\Desktop\Pit_test\Tools\Test_outfill_tbx.py", line 22, in <module>
    outFill = Fill(inSurfaceRaster, zLimit)
  File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Functions.py", line 2271, in Fill
    z_limit)
  File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\Functions.py", line 2267, in Wrapper
    z_limit)
  File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\geoprocessing\_base.py", line 510, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
("esriDataSourcesRaster.RasterWorkspace") Failed to create raster dataset
ERROR 010302: Unable to create the output raster: c:\windows\system32\t_t428.tif
ERROR 010067: Error in executing grid expression.
Failed to execute (Fill).

Failed to execute (TestOutfill).
Failed at Wed Sep 11 17:18:08 2019 (Elapsed Time: 0.49 seconds)
Tags : arcpy


Answers 1


Turns out the file already existed, so I cured it by allowing overwrites (alternatively, by deleting the file before beginning).

William
William
September 11, 2019 23:01 PM

Related Questions


Update Data Driven Pages Index layer via Python

Updated May 28, 2015 00:09 AM