<?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 Re: Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/1001#M135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the clipped file wasn't created? &amp;nbsp;Just trying to narrow down were the glitch is.&lt;/P&gt;&lt;P&gt;Another thing I noticed is the way you call the statistics tool... give this form a shot&lt;/P&gt;&lt;P&gt;arcpy.Statistics_analysis(intable, outtable, stats, casefield) &amp;nbsp; &amp;nbsp;(I know, I know... shouldn't make a difference)&lt;/P&gt;&lt;P&gt;And ditto for Clip... also get rid of the getresult stuff and try to actually use the clipped file. &amp;nbsp;If you get rid of all the message/warning trapping, you may get some useful error messages which are far easier to dissect than those awful try/expcept or pass/continue things.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2017 15:57:16 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-01-06T15:57:16Z</dc:date>
    <item>
      <title>Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro)</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/997#M131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;BR /&gt;I found an inconsistency between arcpy in Python 2.7 and in Python 3.4 (ArcGIS 10.4.1 and ArcGIS Pro 1.3.1 Patch 1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The task is simple. Take an input feature class and a zone feature class, clip the input FC using the zone FC to produce a clipped FC. Then, use the statistics tool to summarize areas (or whatever) by a category field in the clipped FC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The inconsistency occurs when the the zone feature(s) does not intersect the input feature(s):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In Python 2.7, result of the clip tool is an empty feature class with all the columns defined as if there was a feature. Warning 000117 ('empty output generated') is issued but the output feature class does exist. The statistics tool produces an empty output table with the expected fields included. As far as I know, this has been the usual behaviour and that's what my scripts expected.&lt;/LI&gt;&lt;LI&gt;In Python 3.4, result of the clip tool does not produce any output. Warning 000117 is issued but the output feature class does not exist. Calling .getOutput(0) on the clip result object returns the path where the feature class should be, but it is not actually there. Consequently, the statistics tool fails because it requires the result of the clip tool to exist.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need my script to work in both pythons and empty results is a valuable result too. I dealt with it by checking whether the warning was issued. In my case, the task was inside a for-loop and I could simply skip to the next iteration (using the 'continue' statement) when the warning was raised. The code snippet below shows how one can check if the warning was issued and to act accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
geology &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\temp\geology.shp'&lt;/SPAN&gt;
catchment &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\temp\catchment.shp'&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\temp\wdb.gdb'&lt;/SPAN&gt;

stats_table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; None

clipped &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;analysis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Clip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geology&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; catchment&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'clppd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

warnings &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;clipped&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getMessages&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;lower&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'empty output generated'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; warnings&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;pass&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; clipped_fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; clipped&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; stats &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;analysis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Statistics&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;clipped_fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'outtbl'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Shape_Area"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SUM"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LEX"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; stats_table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; stats&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same thing happened when I tried it in ArcGIS Pro user interface so it is probably not a Python problem, but I needed to solve it in Python.&lt;BR /&gt;I hope this will help someone or that someone will tell me if there is a better way to deal with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, &lt;BR /&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:03:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/997#M131</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2021-12-10T20:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro)</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/998#M132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, not a Python issue.&amp;nbsp; You have done a good job narrowing down the issue.&amp;nbsp; Can you open Esri Support cases?&amp;nbsp; If so, either yourself or through your organization, I suggest doing so to get this bug logged.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2017 15:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/998#M132</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-01-04T15:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro)</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/999#M133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have two inputs as shapefiles and your output is not... did you try to set your clipped data out to a shapefile? &amp;nbsp;This would rule the destination to your workspace as the issue&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2017 04:47:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/999#M133</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-01-05T04:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro)</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/1000#M134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Dan, that's a good tip but the inconsistency occurs even if everything is just in shapefiles.&lt;/P&gt;&lt;P&gt;I'll try to find somebody in my organization who can&amp;nbsp;open Esri Support cases.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2017 13:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/1000#M134</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2017-01-06T13:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent 'Empty output generated' in Python 2.7 vs. 3.4 (Desktop vs. Pro)</title>
      <link>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/1001#M135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the clipped file wasn't created? &amp;nbsp;Just trying to narrow down were the glitch is.&lt;/P&gt;&lt;P&gt;Another thing I noticed is the way you call the statistics tool... give this form a shot&lt;/P&gt;&lt;P&gt;arcpy.Statistics_analysis(intable, outtable, stats, casefield) &amp;nbsp; &amp;nbsp;(I know, I know... shouldn't make a difference)&lt;/P&gt;&lt;P&gt;And ditto for Clip... also get rid of the getresult stuff and try to actually use the clipped file. &amp;nbsp;If you get rid of all the message/warning trapping, you may get some useful error messages which are far easier to dissect than those awful try/expcept or pass/continue things.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2017 15:57:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/inconsistent-empty-output-generated-in-python-2-7/m-p/1001#M135</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-01-06T15:57:16Z</dc:date>
    </item>
  </channel>
</rss>

