What's the best approach for updating the geometry of a point features (which start out as null) using the point geometry of a feature from a different feature class? I've been trying to use an Update Cursor to do this. I know how to get it to update a regular attribute, but not a geometry. And in my testing, it's looking like this may not be workable. I keep getting "TypeError: 'tuple' object does not support item assignment" which I find odd because when I check the type, it's "float".
Update: Okay, based on what Adrian pointed out, I changed the iterator in the inner, Search Cursor loop to "row2" and it now works fine. Silly me, I had been thinking "row" was a reserved word:)
I've pasted my new code below. Thank you all - and I'll try to always post correctly formatted code in the future.
<SPAN class="keyword token">import</SPAN> arcpy<SPAN class="punctuation token">,</SPAN> datetime
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'Database Connections\dev-sde.sde'</SPAN> <SPAN class="comment token"># type: str</SPAN>
ws <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace
<SPAN class="comment token"># Start an edit session</SPAN>
edit <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>Editor<SPAN class="punctuation token">(</SPAN>ws<SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Change second parameter to True for versioned data</SPAN>
edit<SPAN class="punctuation token">.</SPAN>startOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
fcs <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"dev.sde.wControlValve"</SPAN><SPAN class="punctuation token">,</SPAN>r<SPAN class="string token">"dev.sde.wSystemValve"</SPAN><SPAN class="punctuation token">,</SPAN>r<SPAN class="string token">"dev.sde.wFitting"</SPAN><SPAN class="punctuation token">)</SPAN>
dt <SPAN class="operator token">=</SPAN> datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">.</SPAN>strptime<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"01/01/1970"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"%d/%m/%Y"</SPAN><SPAN class="punctuation token">)</SPAN>
fd <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"dev.sde.WaterDistribution"</SPAN> <SPAN class="comment token"># type: str</SPAN>
outer_cnt<SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
inner_cnt <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
cnt_not_found <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"{0}\{1}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fd<SPAN class="punctuation token">,</SPAN>r<SPAN class="string token">"dev.sde.wPump"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN>r<SPAN class="string token">"project"</SPAN><SPAN class="punctuation token">,</SPAN>r<SPAN class="string token">"SHAPE@XY"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> ucursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> ucursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>type<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>type<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
src_prj <SPAN class="operator token">=</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
found <SPAN class="operator token">=</SPAN> <SPAN class="string token">"false"</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>src_prj<SPAN class="punctuation token">)</SPAN>
x <SPAN class="operator token">=</SPAN> <SPAN class="number token">0.0</SPAN>
y <SPAN class="operator token">=</SPAN> <SPAN class="number token">0.0</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> fcs<SPAN class="punctuation token">:</SPAN> <SPAN class="comment token">#Start searching through features in the point feature classes for feature with same project #</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"{0}\{1}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fd<SPAN class="punctuation token">,</SPAN> fc<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN>r<SPAN class="string token">"project"</SPAN><SPAN class="punctuation token">,</SPAN> r<SPAN class="string token">"SHAPE@XY"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> icursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row2 <SPAN class="keyword token">in</SPAN> icursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> row2<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="operator token">==</SPAN>src_prj<SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#new_geom = row[1]</SPAN>
<SPAN class="punctuation token">(</SPAN>x<SPAN class="punctuation token">,</SPAN>y<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN> row2<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="comment token">#print(type(new_geom))</SPAN>
<SPAN class="comment token">#print(new_geom)</SPAN>
found <SPAN class="operator token">=</SPAN> <SPAN class="string token">"true"</SPAN>
<SPAN class="keyword token">break</SPAN>
<SPAN class="keyword token">if</SPAN> found <SPAN class="operator token">==</SPAN> <SPAN class="string token">"true"</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>found<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">break</SPAN> <SPAN class="comment token">#Don't need to search in any further feature classes</SPAN>
<SPAN class="keyword token">if</SPAN> found <SPAN class="operator token">==</SPAN> <SPAN class="string token">"true"</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>type<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>x<SPAN class="punctuation token">,</SPAN>y<SPAN class="punctuation token">)</SPAN>
ucursor<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
cnt_not_found<SPAN class="operator token">+=</SPAN><SPAN class="number token">1</SPAN>
<SPAN class="comment token"># Stop Edit Session</SPAN>
edit<SPAN class="punctuation token">.</SPAN>stopOperation<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
edit<SPAN class="punctuation token">.</SPAN>stopEditing<SPAN class="punctuation token">(</SPAN><SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>str<SPAN class="punctuation token">(</SPAN>cnt_not_found<SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN> " project <SPAN class="comment token">#s were not found in the listed feature classes")</SPAN>
<SPAN class="keyword token">del</SPAN> icursor
<SPAN class="keyword token">del</SPAN> ucursor