heunt

Extract By Mask ERROR 99999: Error executing functio

Discussion created by heunt on Apr 2, 2018

I'm running into an issue with a python script that includes the Extract by Mask command. The script always runs as expected when it's launched from the ArcToolbox. However, when I run the script from an IDE or the .Net GUI of the application that's intended to run the script, the Extract By Mask command returns ERROR 999999: Error executing function; for a particular dataset, the script may run as expected 2 out of 10 times. Here's a snippet of the code, the last like being the one that produces the error:

 

            GPMsg("t", "Create facmask")

            fdr = Raster(tmp_fdr)
            cat = Raster(tmp_cat)
            swnet = Raster(tmp_swnet)

            env.cellSize = fdr.meanCellHeight
            env.extent = fdr.extent
            env.snapRaster = fdr.catalogPath
            env.outputCoordinateSystem = fdr.spatialReference

            # create boolean rasters (1=True, 0=False)
            # outrpu: cells outside RPU catchments (0=inside, 1=outside)
            outrpu = IsNull(cat)
            # swnet1: cells on flownet (without waterbody cells)
            swnet0 = Con(IsNull(swnet), 0, swnet)
            swnet1 = Con(swnet0 == 1, 1 , 0)
            # erase those that coincide with adjacent flowlines (except outflow)
            where = "PurpCode = 'AO'"
            lyrAddLine = arcpy.MakeFeatureLayer_management(burnaddline,
                                                           "_afl", where)
            if procutil.RowTest(lyrAddLine):
                bufsize = fdr.meanCellHeight * 1.42 * 0.5
                tbuf = arcpy.Buffer_analysis(lyrAddLine, "tline.shp", bufsize)
                ao_cells = ExtractByMask(swnet1, tbuf) # ERROR 999999: Error executing function

Outcomes