Error while creating slope

Discussion created by petrilk on Dec 30, 2011
Latest reply on Dec 30, 2011 by GAlallasundaram-esristaff

I'm creating slopes from DTMs as a batch process with python. I get really strange error.
When I do the process to a DTM file for the first time I get the error "arcgisscripting.ExecuteError: ERROR 010240: Could not save raster dataset to C:\ICIMOD\Slope\g_g_g2 with output format GRID. Failed to execute (Slope)."

BUT if I run the process again it goes through and creates the slope correctly but gives the same error for the second file in the batch. And again if the batch is run again, the second slope is created correctly and the error comes for the third file etc.

My python code is as follows:
for i in DTM:
IC_tif= "C:\\ICIMOD\\DTM\\ic0" + str(i) + ".tif"
IC_slope = "C:\\ICIMOD\\Slope\\IC0" + str(i) + "_slope"
gp.Slope_sa(IC_tif, IC_slope, "DEGREE", "0.001")

I have used the batch before and then it made about 20-30 files and then gave the error. I assume it's some kind of memory error.

Does anyone know I could get past this problem, because I don't want to restart the batch hundreds of times.