Eco_Site

Python script field calculator skipping rows

Discussion created by Eco_Site on Feb 26, 2014
Latest reply on Mar 3, 2014 by jacobne
I built a Python tool that uses Field Calculator to add and calculate a few different fields in a shapefile, including area as well as a few simple string variables based on user input. The function throws no errors and works fine, except that it seems to randomly skip rows, leaving zeroes (for numbers) or blanks (for string variables) instead of calculating the values. The blank/zero rows tend to come in big chunks, not scattered, but other than that there is no obvious pattern.

If I open up the output shapefile in ArcGIS and calculate those same fields using the Field Calculator or Calculate Geometry tools, the zeroed/blank values calculate without a problem, so it isn't a problem with the shapefile itself being corrupt. I have tried the script over and over with a variety of shapefiles, and while it occasionally works, 95% of the time at least some rows are skipped.

I'm curious if anyone has experienced this problem before or might have suggestions for solutions.

Outcomes