danrosauer

Crashing on arcpy.sa.PathAllocation

Discussion created by danrosauer on Oct 1, 2012
Latest reply on Oct 4, 2012 by danrosauer
Hi

I hope one of you can help me...

In a for loop, my code selects in turn, a different set of points in a layer.

It then runs PathAllocation for the selected points, as follows:

    if Distance_method == "model-cost": 
        ## calculates the least cost distance to the nearest lineage point
        ## the result is written directly to lineage_dist_gridname
        temp = arcpy.sa.PathAllocation(in_source_data="lin_lyr", in_cost_raster=maxent_model, out_distance_raster=lineage_dist_gridname)    
        lin_dist = arcpy.sa.Raster(lineage_dist_gridname)
        layers_to_delete.append(lineage_dist_gridname)


The problem is that it always fails the second time the loop hits the PathAllocation line.  The message is: python.exe has stopped working.

This behavior is independent of the particular data selected on that iteration - I've tried changing the dataset, and the order, and it still fails on the second pass through the loop.

The filename defined in lineage_dist_gridname is different on each iteration, so it is not a problem of overwriting the raster created on the first iteration.

Has anyone hit a similar crash or has some idea about the cause?

many thanks
Dan

Outcomes