This error "SystemError: error return without exception set" only recently popped up in an implementation and it only happens on some, not all, polygon features that are processed. Error is throw on this line:
pcent <SPAN class="operator token">=</SPAN> polygon<SPAN class="punctuation token">.</SPAN>centroid<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
All this does is take the geometry attribute of some JSON (a polygon feature service) and gets the centroid. I'm not sure what exactly is wrong with the geometry but seems to cause the error.
Attached .txt file contains the "inputJSON" variable (I thought it best to just add it in a file vs. paste in the post).
inputJSON <SPAN class="operator token">=</SPAN> <SPAN class="operator token"><</SPAN>grab <SPAN class="keyword token">from</SPAN> attached <SPAN class="punctuation token">.</SPAN>txt file<SPAN class="operator token">></SPAN>
inSr <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">(</SPAN><SPAN class="number token">3857</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> i <SPAN class="keyword token">in</SPAN> inputJSON<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'geometry'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'rings'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN>
coordinates <SPAN class="operator token">=</SPAN> i
polygon <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Polygon<SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>Array<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>Point<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN>coords<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> coords <SPAN class="keyword token">in</SPAN> coordinates<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> inSr<SPAN class="punctuation token">)</SPAN>
pcent <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Point
pcent <SPAN class="operator token">=</SPAN> polygon<SPAN class="punctuation token">.</SPAN>centroid <SPAN class="comment token">#error occurs here</SPAN>
<SPAN class="keyword token">return</SPAN> pcent<SPAN class="punctuation token">.</SPAN>X<SPAN class="punctuation token">,</SPAN> pcent<SPAN class="punctuation token">.</SPAN>Y<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>