Hello everyone,
I have this python stand alone script wich is runing fine until gets to this part.
The error I get is: arcgisscripting.ExecuteError: Error 9999999: Error executing function. The field is not nullable. [COST]. Failed to execute <Calculate field>
It creates the field "cost" but doesn't fill it. In ArcMap I open the shape and I'm able to fill it with zero value so I don't understand the error.
Any suggestions??
Thanks a lot
I have this python stand alone script wich is runing fine until gets to this part.
Code:
if gp.Exists(lcp_name+".shp") == 0:
gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE", "")
# Export the cost of the LCP
vat = gp.searchcursor("cost_path")
row_n = vat.next()
cost1_list = []
while row_n:
cost1_list.append(row_n.pathcost)
row_n = vat.next()
cost1 = sum(cost1_list)
del vat, row_n, cost1_list
# Turns the raster LCP to a polyline
gp.RasterToPolyline_conversion("cost_path","temp.shp", "ZERO", "", "SIMPLIFY")
gp.Dissolve_management("temp.shp", lcp_name+".shp")
gp.delete_management("temp.shp")
gp.delete_management("cost_path")
# Calculate the length of the LCP.
gp.Addfield_management(lcp_name+".shp", "LENGTH", "DOUBLE")
gp.CalculateField_management(lcp_name+".shp", "LENGTH", "float(!SHAPE.LENGTH!)", "PYTHON")
gp.Addfield_management(lcp_name+".shp", "COST", "DOUBLE")
gp.CalculateField_management(lcp_name+".shp", "COST", cost1, "PYTHON")
It creates the field "cost" but doesn't fill it. In ArcMap I open the shape and I'm able to fill it with zero value so I don't understand the error.
Any suggestions??
Thanks a lot