AnsweredAssumed Answered

Creating several buffers in a loop fails silently

Question asked by wysek on Mar 6, 2015
Latest reply on Mar 11, 2015 by dkwiens

I'm experiencing a very weird behaviour when I try to create either several single or multiple buffers. I have a python script which conducts geoprocessing (creating buffers is one of the first steps) on a series (about 100) of feature classes (consisting of a single point) in a loop.


My problem is that when I run this script always up to 50-70% of buffers operations fail. After the script is complete and I run it again I get a similar behavior but some of the data, for which the calculations previously failed, is calculated correctly. If I run it enough number of times all calculations will complete succesfully.


One interesting thing is that if I try to recalculate buffers in the same process (after failing I immediately retry) it will infinitely fail. I need to finish one process and start another one in order to have a chance that another try will succeed.


Another interesting and most painful thing is that the operation itself does not fail and does not give any errors. Both Buffer_analysis and MultipleRingBuffer_analysis finish without errors, but the output layer is not created or is empty.


In each iteration I set a different workspace and scratchworkspace (which is a file gdb), so it is not a problem with temp files being overwritten (unless there are some temp files created behind the scene). I also have access to the files (both for reading and writing) at all times. Each time I set several env parameters (scratchWorkspace, workspace, snapRaster, cellSize, overwriteOutput, addOutputsToMap) and save output to different catalogs.


I also don't do anything fancy in the code, I create buffers using either:


arcpy.MultipleRingBuffer_analysis(r"path_to_fc", r"output_path_for_shp", [2, 10.5, 18.3], 'Kilometers', 'fieldname')


At first I thought that maybe MultipleRingBuffer_analysis, which is just a python script, does something under the hood, so I reimplemented it as a loop creating single buffers and later unify and dissolve them. This is the part that fails:


for dist in [2, 10.5, 18.3]:

    arcpy.Buffer_analysis(r"path_to_fc.shp", r"output_path_{}.shp".format(dist), "{} kilometers".format(dist), "FULL", "ROUND")


My configuration is following:

- Win 7 64-bit

- XEON E5649 6 cores

- 8 GB RAM

- > 100 GB disk space