I have a code written in Python using arcpy where I am looping through all of the features in a feature class, performing multiple operations. It works correctly and runs for a while until it doesn't. I was running in IDLE at first and the code would just stop; no error message, no warnings, nothing. All I would see is the RESTART text in the Shell. This was confusing, but I'd re-run and it would again process away on other features until, again, it didn't (I had a snippet handling features already successfully processed). I moved to PyCharm to see if the same behaviour would be observed and it does the same, but now I get an error message but it doesn't display as a typical PyCharm error; it is just text:
FATAL ERROR (INFADI)
MISSING DIRECTORY
What is going on here? I have thousands of features to process and it is going to take multiple days. I don't want to babysit this thing.... here is the code in full:
arcpy.SelectLayerByAttribute_management(layer1, 'NEW_SELECTION', '"Proccessed" = \'InComplete\'')
total = int(arcpy.GetCount_management(layer1).getOutput(0))
current = 1
print 'Start time = {}'.format(datetime.datetime.fromtimestamp(time.time()).strftime('%b %d, %Y @ %H:%M:%S'))
with arcpy.da.UpdateCursor(points,['SHAPE@', 'wtrshd_ha', 'runoff_ca', 'wtrshd_slp', 'dem','wtrshddist', 'max_elev', 'ids', 'proccessed']) as cursor:
for point in cursor:
try:
ids = point[7]
if point[8] == 'Complete' or point[8] == 'Error':
continue
print 'Working on point {} of {}'.format(str(current), str(total))
dsc = arcpy.Describe(dem)
arcpy.env.extent = dsc.Extent
#print 'Creating watershed'
arcpy.gp.Watershed_sa(flow_direction, point[0], 'watersheds')
arcpy.gp.RasterToPolygon_conversion('watersheds', 'watershed', "NO_SIMPLIFY")
arcpy.AddField_management('watershed', 'w_id', 'LONG')
arcpy.CalculateField_management('watershed', 'w_id', '{}'.format(str(ids)))
dsc = arcpy.Describe('watershed')
arcpy.env.extent = dsc.Extent
#print 'Assigning watershed area to point'
area = 0
for r in arcpy.SearchCursor('watershed'):
area += (r.getValue("shape_area")) / float(10000)
point[1] = area
#print 'Assigining maximum elevation to point'
arcpy.gp.ExtractByMask_sa(dem, 'watershed', 'ext_dem1')
arcpy.gp.ExtractByMask_sa('slope', 'watershed', 'slope1')
max_elv = (arcpy.GetRasterProperties_management("ext_dem1", "MAXIMUM")).getOutput(0)
#print 'Setting maximum distance for cost path
ras = SetNull(Raster("ext_dem1"),Raster("ext_dem1"), '"Value" <> {}'.format(max_elv))
arcpy.gp.RasterToPoint_conversion(ras, 'to')
arcpy.PointDistance_analysis(point[0], "to", out_loc + "\\dist1.dbf")
dist = 0
for f in arcpy.SearchCursor(out_loc + "\\dist1.dbf"):
if f.getValue("distance") > dist:
dist = f.getValue("distance")
#print 'Creating cost path to determine length of watershed
cbl = CostBackLink(point[0], "slope1", float(dist*1000))
cp = CostPath("to", "slope1", cbl, 'BEST_SINGLE')
arcpy.gp.RasterToPolyline_conversion(cp,'path')
distance = 0
for r in arcpy.SearchCursor('path'):
distance += r.getValue("Shape_Length")
point[3] = float((float(max_elv) - float(point[4])) / float(distance))
point[5] = distance
point[6] = max_elv
del cbl,cp,distance
#print 'Assigining runoff coefficient to point'
arcpy.gp.ExtractByMask_sa(runoff, 'watershed', 'ext_runoff')
ras_count = 0
for r in arcpy.da.SearchCursor('ext_runoff', ["VALUE", "COUNT"]):
ras_count += r[1]
runoff_c = 0
for r in arcpy.da.SearchCursor('ext_runoff', ["VALUE", "COUNT"]):
runoff_c += (float(r[0])/float(100) * float(r[1])/float(ras_count))
point[2] = runoff_c
point[8] = 'Complete'
try:
arcpy.Append_management('watershed','All_Watersheds')
except:
print 'Append not working'
sys.exit()
cursor.updateRow(point)
current += 1
except:
print str(ids) + ' No Worky'
total -= 1
point[8] = 'Error'
cursor.updateRow(point)
PyCharm output:
......
Working on point 54 of 2464
Cost Distance Mapping
Please wait ...
Working on point 55 of 2464
FATAL ERROR (INFADI)
MISSING DIRECTORY