<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Creating several buffers in a loop fails silently in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749396#M5116</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also don't do anything fancy in the code, I create buffers using either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.MultipleRingBuffer_analysis(r"path_to_fc", r"output_path_for_shp", [2, 10.5, 18.3], 'Kilometers', 'fieldname')&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;for dist in [2, 10.5, 18.3]:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(r"path_to_fc.shp", r"output_path_{}.shp".format(dist), "{} kilometers".format(dist), "FULL", "ROUND")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My configuration is following:&lt;/P&gt;&lt;P&gt;- Win 7 64-bit&lt;/P&gt;&lt;P&gt;- XEON E5649 6 cores&lt;/P&gt;&lt;P&gt;- 8 GB RAM&lt;/P&gt;&lt;P&gt;- &amp;gt; 100 GB disk space&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Mar 2015 13:35:16 GMT</pubDate>
    <dc:creator>MichalWysokinski</dc:creator>
    <dc:date>2015-03-06T13:35:16Z</dc:date>
    <item>
      <title>Creating several buffers in a loop fails silently</title>
      <link>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749396#M5116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also don't do anything fancy in the code, I create buffers using either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.MultipleRingBuffer_analysis(r"path_to_fc", r"output_path_for_shp", [2, 10.5, 18.3], 'Kilometers', 'fieldname')&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;for dist in [2, 10.5, 18.3]:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(r"path_to_fc.shp", r"output_path_{}.shp".format(dist), "{} kilometers".format(dist), "FULL", "ROUND")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My configuration is following:&lt;/P&gt;&lt;P&gt;- Win 7 64-bit&lt;/P&gt;&lt;P&gt;- XEON E5649 6 cores&lt;/P&gt;&lt;P&gt;- 8 GB RAM&lt;/P&gt;&lt;P&gt;- &amp;gt; 100 GB disk space&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 13:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749396#M5116</guid>
      <dc:creator>MichalWysokinski</dc:creator>
      <dc:date>2015-03-06T13:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating several buffers in a loop fails silently</title>
      <link>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749397#M5117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Had you considered using a cursor and maybe buffering the point geometry to create your buffers?&amp;nbsp; Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy


ofc ="path_to_output_fc"
outcur = arcpy.InsertCursor(ofc)
fc = "path_input_point_fc"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt = row.shape
&amp;nbsp;&amp;nbsp;&amp;nbsp; ptgeo = arcpy.PointGeometry(pt)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ptbuff1 = ptgeo.buffer(distance1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow = outcur.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow.setValue("shape",ptbuff1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outcur.insertRow(orow)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ptbuff2 = ptgeo.buffer(distance2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow = outcur.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow.setValue("shape",ptbuff2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outcur.insertRow(orow)
&amp;nbsp;&amp;nbsp;&amp;nbsp; ptbuff3 = ptgeo.buffer(distance3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow = outcur.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; orow.setValue("shape",ptbuff3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outcur.insertRow(orow)


del outcur, orow, row, cursor&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:50:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749397#M5117</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2021-12-12T07:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating several buffers in a loop fails silently</title>
      <link>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749398#M5118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you post your entire script, we may have a better chance of diagnosing the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 21:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/creating-several-buffers-in-a-loop-fails-silently/m-p/749398#M5118</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-03-11T21:21:13Z</dc:date>
    </item>
  </channel>
</rss>

