<?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: UdateCursor with Select By Location in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500054#M39284</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, typically not....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2019 23:43:44 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2019-12-11T23:43:44Z</dc:date>
    <item>
      <title>UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500049#M39279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do a select by location and then update the selected features, seems easy enough but i am see to get it figured out. Basically i want to update &lt;SPAN style="text-decoration: underline;"&gt;only&lt;/SPAN&gt; the parcels that are within the City limits layer and update the 4 fields. I have tried different variations but i can't seem to get to work. I don't get any errors and also doesn't stop. I would appreciate any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what i have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
from datetime import datetime as d
startTime = d.now()
start_time = time.time()

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/Temp/blah.gdb"

fc1 = "C:/Temp/blah.gdb/Parcels"

CITY = "C:/Temp/blah.gdb/City_Limits"

with arcpy.da.UpdateCursor(fc1, ['field1','field2','field3', 'field4']) as cursor:
    for row in cursor:
        #Select all parcels within the city limits layer
        arcpy.SelectLayerByLocation_management(fc1,"HAVE_THEIR_CENTER_IN", CITY)
        result = arcpy.GetCount_management(fc1)
        row [0] =  "IN CITY"
        row [1] =  "IN CITY"
        row [2] =  "IN CITY"
        row [3] =  "IN CITY"
        cursor.updateRow(row)
    del row, cursor
    
print('Done')
try:
    print ('(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')')

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print ("Line %i" % tb.tb_lineno)
    print (e.message)
&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:57:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500049#M39279</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-11T21:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500050#M39280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see you using any 'layers' (aka, lyrx files) but featureclasses.&lt;/P&gt;&lt;P&gt;see code examples in&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm"&gt;Make Feature Layer—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-location.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-location.htm"&gt;Select Layer By Location—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 20:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500050#M39280</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-11T20:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500051#M39281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the following nothing happens, no error and the fields don't get updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
from datetime import datetime as d
startTime = d.now()
start_time = time.time()

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/Temp/blah.gdb"

fc1 = "C:/Temp/blah.gdb/Parcels"
arcpy.MakeFeatureLayer_management(fc1, "fc1tLyr")

CITY = "C:/Temp/blah.gdb/City_Limits"
arcpy.MakeFeatureLayer_management(CITY, "CityLyr")

with arcpy.da.UpdateCursor(fc1, ['field1','field2','field3', 'field4']) as cursor:
    for row in cursor:
        #Select all parcels within the city limits layer
        arcpy.SelectLayerByLocation_management("fc1tLyr","HAVE_THEIR_CENTER_IN", "CityLyr")
        result = arcpy.GetCount_management("fc1tLyr")
        row [0] =  "IN CITY"
        row [1] =  "IN CITY"
        row [2] =  "IN CITY"
        row [3] =  "IN CITY"
        cursor.updateRow(row)
    del row, cursor
    
print('Done')
try:
    print ('(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')')

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print ("Line %i" % tb.tb_lineno)
    print (e.message)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:57:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500051#M39281</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-11T21:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500052#M39282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe you need to open an edit session?&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.6/analyze/arcpy-data-access/editor.htm" title="https://desktop.arcgis.com/en/arcmap/10.6/analyze/arcpy-data-access/editor.htm"&gt;Editor—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 23:22:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500052#M39282</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-11T23:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500053#M39283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data is in file database i didn't think i need to start an edit session.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 23:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500053#M39283</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2019-12-11T23:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500054#M39284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, typically not....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 23:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500054#M39284</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-11T23:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500055#M39285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;throw in a print statement to see how many were selected&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 23:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500055#M39285</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-11T23:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500056#M39286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But if none are actually selected, would &lt;EM&gt;all&lt;/EM&gt; get updated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 23:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500056#M39286</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-11T23:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500057#M39287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually, I am not even sure why the selectbylocation is within the loop in the first place&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm"&gt;Editor—Data Access module | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you may be right about the edit session since Pro ISN'T open (see the code samples at the end)&lt;/P&gt;&lt;P&gt;I suspect 1 selectbylocation with the featurelayer, then the edit session, then the cursor stuff with lots of print statements thrown in to see w.t.h. is going on&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 01:19:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500057#M39287</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-12T01:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500058#M39288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi 2 Quicker (and not Dan &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/silly.png" /&gt;) &amp;lt;edited&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nice script, a couple of things that should get it working:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;move the selection outside of the "with" statement&lt;/LI&gt;&lt;LI&gt;you were not using the "result" of the count in this snippet, so i included some more print statements to give more feedback&lt;/LI&gt;&lt;LI&gt;the update cursor now runs on the selection rather than the full data set&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if this doesn't work then i would suggest&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;adding in a unique identifier if one doesn't already exist&lt;/LI&gt;&lt;LI&gt;building a list/set from the selection&lt;/LI&gt;&lt;LI&gt;iterating over fc1 and updating the fields "if &amp;lt;uniqueID&amp;gt; in &amp;lt;list&amp;gt;"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If you like i can do up a skeleton of this option as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps and good luck &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&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
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; datetime &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; d

startTime &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
start_time &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;time&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&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; &lt;SPAN class="string token"&gt;"C:/Temp/blah.gdb"&lt;/SPAN&gt;

fc1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/Temp/blah.gdb/Parcels"&lt;/SPAN&gt;

CITY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/Temp/blah.gdb/City_Limits"&lt;/SPAN&gt;

selection &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"HAVE_THEIR_CENTER_IN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; CITY&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
numberoffeaturesfc1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;selection&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
count &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;findwhatsincity&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="keyword token"&gt;global&lt;/SPAN&gt; count
    &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;selection&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'field1'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'field2'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'field3'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'field4'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# Select all parcels within the city limits layer&lt;/SPAN&gt;
            row&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="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"IN CITY"&lt;/SPAN&gt;
            row&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="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"IN CITY"&lt;/SPAN&gt;
            row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"IN CITY"&lt;/SPAN&gt;
            row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"IN CITY"&lt;/SPAN&gt;
            count &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
            cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cursor
    
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Done'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Starting Script @ '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; startTime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    findwhatsincity&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Number of features in '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;": "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;numberoffeaturesfc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Number of features in selection: '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;result&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Number of features processed: '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;count&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'(Elapsed time: '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; startTime&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="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;')'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;# If an error occurred, print line number and error message&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; traceback&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sys

    tb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exc_info&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="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Line %i"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; tb&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;tb_lineno&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;message&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:57:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500058#M39288</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T21:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500059#M39289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not my script &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 03:59:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500059#M39289</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-12T03:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500060#M39290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whoops &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;BR /&gt;Sorry Dan and 2 Quicker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 04:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500060#M39290</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-12T04:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500061#M39291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just curious: Why declare count outside the def, and then make it global inside the def?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 11:32:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500061#M39291</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-12T11:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500062#M39292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone that replied. I was able to come with the following code that works for me.&lt;/P&gt;&lt;P&gt;fyi, &lt;SPAN class=""&gt;&lt;A _jive_internal="true" data-userid="282596" data-username="mboyceesriaustralia-com-au-esridist" href="https://community.esri.com/people/mboyceesriaustralia-com-au-esridist" target="_blank"&gt;Michael Boyce&lt;/A&gt;&lt;/SPAN&gt; your code did work by the way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
from datetime import datetime as d
startTime = d.now()
start_time = time.time()

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/Temp/blah.gdb"

fc1 = "C:/Temp/blah.gdb/Parcels"
arcpy.MakeFeatureLayer_management(fc1, "fc1Lyr")

CITY = "C:/Temp/blah.gdb/City_Limits"
arcpy.MakeFeatureLayer_management(CITY, "CityLyr")

with arcpy.da.SearchCursor("CityLyr", ["SHAPE@"]) as cursor:
    for row in cursor:
        #SELECT PROPERTIES BY CITYLIMITS
        selection = arcpy.SelectLayerByLocation_management("fc1Lyr","HAVE_THEIR_CENTER_IN", "CityLyr")
        result = int(arcpy.GetCount_management("fc1Lyr").getOutput(0)) 
        with arcpy.da.UpdateCursor(selection, ['field1','field2','field3', 'field4']) as cursor:
            for row in cursor:
                # Select all parcels within the city limits layer
                row[0] = "IN CITY"
                row[1] = "IN CITY"
                row[2] = "IN CITY"
                row[3] = "IN CITY"
                cursor.updateRow(row)
            del row, cursor

try:
    print ('(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')')
    print ('Number of features processed: ' + str(result))

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print ("Line %i" % tb.tb_lineno)
    print (e.message)&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:57:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500062#M39292</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-11T21:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500063#M39293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Umm, no reason.&amp;nbsp; Since i was coding on the fly i didn't really think about it.&amp;nbsp; By rights you are correct and that it should be inside the def to make the code cleaner.&amp;nbsp; Then it would not require the global call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 21:20:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500063#M39293</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-12T21:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500064#M39294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very nice &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;Good to see you got a solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a pointer to make your code more error proof:&lt;BR /&gt;At the moment the only things in the try/except statement are the print statements.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This means that an exception will only be called if something goes wrong with the print calls, but an exception will not be handled in any of the calls above.&lt;BR /&gt;Either move the try to the top, around line 14 or define a function and place everything in it then call the function inside the try statement at the bottom.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way if something goes wrong you will be able to debug a whole lot better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy coding&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 21:38:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500064#M39294</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-12T21:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500065#M39295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay cool...&amp;nbsp; I avoid global variables and it just kind of jumped out at me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 21:56:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500065#M39295</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-12T21:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: UdateCursor with Select By Location</title>
      <link>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500066#M39296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I usually do as well, but i just finished scripting a fairly interesting project where i had to pass variables between three different scripts for threading.&amp;nbsp; So i guess that i had globals on the brain.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 22:07:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/udatecursor-with-select-by-location/m-p/500066#M39296</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-12T22:07:31Z</dc:date>
    </item>
  </channel>
</rss>

