AnsweredAssumed Answered

Arcpy script results in RuntimeError: ERROR 999998: Unexpected Error

Question asked by KonanPruiksma5 on Apr 14, 2020
Latest reply on Apr 14, 2020 by slynch-esristaff

I made this pretty simple tool with the code below and all through last night it ran error free on every run. Now since this morning I am getting a RuntimeError: 999998: Unexpected Error. The error occurs on line 15:'D:\Documents\LocalReliefModel\TestRaster\difmodel.tif')

I have no idea why it isn't working all of the sudden. I can see it writing the raster file in the given location, but it gets deleted immediately and than the RuntimeError happens. I can't really find any solution and have tried different paths, names, setting it as a variable, etc.


Does anyone know what to do?


import arcpy
from import *

arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'D:\Documents\LocalReliefModel'

DEM_org = r'D:\Documents\LocalReliefModel\TestRaster\GH_Toterfout.tif'

# Low pass filter -> Smoothed DEM (focal statistics)
outFocalStat =, NbrRectangle(50, 50, "CELL"), 'MEAN')'D:\Documents\LocalReliefModel\TestRaster\LPF.tif')

# Subtract smoothed DEM from the original DEM -> Difference model (Minus function)
outMinus =, DEM_org)'D:\Documents\LocalReliefModel\TestRaster\difmodel.tif')

# Calculate the zero meters contours for the Difference model ->
# set of the break lines between the positive and negative features (convex and concave features; Contour function)
outCont_save = r'D:\Documents\LocalReliefModel\TestRaster\ZeroCont.tif'
outCont =, outCont_save, 100)

# Extract the real elevation of the cells from the original DEM, which intersects with the break lines ->
# simplified elevation raster (Extract by Mask function)
outMask =, outCont)'D:\Documents\LocalReliefModel\TestRaster\ElExtract.tif')

# Convert the simplified elevation raster to the point features (only nonzero cells) ->
# elevation points (Raster to Point function)
outRastToPoint_save = r'D:\Documents\LocalReliefModel\TestRaster\RastToPoint'
outRastToPoint = arcpy.RasterToPoint_conversion(outMask, outRastToPoint_save)