<?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: Select points and update attributes base on parcels in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444641#M34839</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recreated the database and re-ran the code and it ran fine. some how the address point database got corrupted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if the address point did not an have attribute in the "Account" field this would not work because there is nothing to match with the Parcels "ACCOUNT" attribute. So would a spatial join work in a situation where the address point does not have an attribute in the "Account" field.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2015 18:16:05 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2015-07-09T18:16:05Z</dc:date>
    <item>
      <title>Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444628#M34826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working a code/button that will help me update address points attributes based on the parcel they are in.&lt;/P&gt;&lt;P&gt;I am trying to to use filed list to create a mach and update the points with dictionaries. I don't not get error but my address points don't get updated from the parcels. I would appreciate any help with my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
from datetime import datetime as d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
startTime = d.now()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 


#set to folder where features are located&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.env.workspace = r"Database Servers\DSD15_SQLEXPRESS.gds\TEST (VERSION:dbo.DEFAULT)" #r"Database Servers\DSD15_SQLEXPRESS.gds\TonyTwoWay (VERSION:dbo.DEFAULT)" #on windows use \ instead of /&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.env.overwriteOutput = True
arcpy.env.qualifiedFieldNames = False


#define variables for cursor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
#---------------------------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
FC = "TEST.DBO.CCAPTEST"&amp;nbsp; #pointlayer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
TaxPar = "TaxParcels" #Parcels
poly = "ACCOUNT"#'SiteAddres_1','SiteAddres_1', 'SiteNum_1', 'SiteNumSfx_1','Predir_1','SiteStreet_1', 'StreetType_1', 'Postdir_1', 'SiteCity_1', 'SiteZIP_1', 'OwnerName_1' 
Pnt =&amp;nbsp; "Account"#
TaxPar1 = "selectedParcels"


parcelsCount = int(arcpy.GetCount_management(FC).getOutput(0))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
dsc = arcpy.Describe(FC) 
selection_set = dsc.FIDSet&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if len(selection_set) == 0:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "There are no features selected"&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
elif parcelsCount &amp;gt;= 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Select parcel within selected Address Points
&amp;nbsp;&amp;nbsp;&amp;nbsp; int(arcpy.GetCount_management(FC).getOutput(0))
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(TaxPar, "CONTAINS", FC)


&amp;nbsp;&amp;nbsp;&amp;nbsp; #Create in memory parcel layer&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; selectedParcels = arcpy.MakeFeatureLayer_management(TaxPar, TaxPar1)



&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(TaxPar1, "NEW_SELECTION", "OBJECTID= "+OID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # define the field list from the parcels
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFieldsList = ["ACCOUNT", poly,"SiteAddres",'SiteNum', 'SiteStreet','SiteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZIP', 'OwnerName']&amp;nbsp;&amp;nbsp;&amp;nbsp; 


&amp;nbsp;&amp;nbsp;&amp;nbsp; # define the field list to the points
&amp;nbsp;&amp;nbsp;&amp;nbsp; updateFieldsList = ["Account", Pnt,"SiteAddres", 'SiteNum', 'SiteStreet', 'SiteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZip', 'OwnerName']
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Start an edit session. Must provide the workspace.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit = arcpy.da.Editor(arcpy.env.workspace)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Edit session is started without an undo/redo stack for versioned data&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp; (for second argument, use False for unversioned data)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startEditing(True)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Start an edit operation&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startOperation()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 


&amp;nbsp;&amp;nbsp;&amp;nbsp; # populate the dictionary from the polygon
&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(TaxPar1, sourceFieldsList)}&amp;nbsp;&amp;nbsp;&amp;nbsp; 


&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(FC, updateFieldsList) as updateRows:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if keyValue in valueDict:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for n in range (1,len(sourceFieldsList)):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow&lt;N&gt; = valueDict[keyValue][n-1]&lt;/N&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Stop the edit operation.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Stop the edit session and save the changes
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopEditing(True)


arcpy.RefreshActiveView()
#arcpy.Delete_management(sjpoints)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444628#M34826</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T19:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444629#M34827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code is missing the indentation. Please make sure it pastes in with the indentation preserved or else it's difficult for us to interpret what you really intend your code to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, on line 48, did you mean to assign that to a variable or something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 21:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444629#M34827</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-07-08T21:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444630#M34828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I notice the indentations where off when attached my code. I tried to fix the indentations but it would not let me.&lt;/P&gt;&lt;P&gt;I am using line 48 to use the selected point for line 50 for the selectlayerbylocation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:08:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444630#M34828</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-08T22:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444631#M34829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2CDSD 2C,&lt;/P&gt;&lt;P&gt;for future reference with posting code &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For me, what works best is copying it over first, then applying the syntax to the block I just copied over...which is what Curtis shows in the blog.&amp;nbsp; It never seems to work for me if I try to fix it after it is formatted on GeoNet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:16:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444631#M34829</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-07-08T22:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444632#M34830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's usually how post code too, but for some reason it mess it up. Maybe it's firefox....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:22:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444632#M34830</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-08T22:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444633#M34831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It must be FireFox, i just posted an update to my code and worked .&lt;/P&gt;&lt;P&gt;I remove some unnecessary lines.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:26:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444633#M34831</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-08T22:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444634#M34832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I usually use Firefox and it works ok....but there are so many flavors of Firefox, it's hard to say.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:28:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444634#M34832</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-07-08T22:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444635#M34833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using an edit session?&amp;nbsp; Update cursors do not need an edit session to work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should try debugging with some print statements to make sure the values that you are your dictionary keys and the values they are returning are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing you are basing this on &lt;A href="https://community.esri.com/migrated-users/4811"&gt;Richard Fairhurst&lt;/A&gt;​, &lt;A href="https://community.esri.com/migration-blogpost/1885"&gt;Turbo Charging Data Manipulation with Python Cursors and Dictionaries&lt;/A&gt;​.&amp;nbsp; I have a working script that does the exact thing you are doing for converting data to LGIM for my other job.&amp;nbsp; I can take a look at it tomorrow and help out if the edit session is not the issue.&amp;nbsp; Also perhaps Richard could help you out, he is usually more than willing to help people adapt his code to thier own use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 22:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444635#M34833</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-08T22:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444636#M34834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;The variable OID is not assigned a value as far as I can see.&amp;nbsp; So line 40 is selecting nothing.&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp; But SelectLayerByAttribute is unnecessary.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;If you are writing to SDE data that is versioned then you do need to do the Editor operation.&amp;nbsp; However, you should use the with syntax to get errors reported and automated closure of the session&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you over complicating this and you are creating unnecessary selections.&amp;nbsp; Selections inside selections is just another embedded loop and is BAD.&amp;nbsp; Don't do that.&amp;nbsp; Just use a dictionary and load every selected parcel into it all at once.&amp;nbsp; It will do the Account look up 100 times faster than SelectLayerByAttribute.&amp;nbsp; So use the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I based this on your code.&amp;nbsp; Your code assumes that Account in the address points already matches Account in the Parcels and that no two parcels have the same Account.&amp;nbsp; If the Account of the Address that touches a parcel is not the same as the Account on the parcel then the update cursor won't work.&amp;nbsp; If the real match is only spatial then this code approach won't work.&amp;nbsp; Also if two addresses have the same Account and fall on two parcels with the same accounts, the result will just use the last parcel with that account that is read and not necessarily the parcel touched by the address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a pure spatial match I would do a Spatial Join with the One To Many option to an in_memory fc, not SelectLayerByLocation.&amp;nbsp; The Spatial Join is much faster and more reliable for spatial matching than any attribute that may or may not be spatially related.&amp;nbsp; The Spatial Join result would have the necessary ObjectID values to use the cursor for the transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
from datetime import datetime as d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
startTime = d.now()

#set to folder where features are located&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.env.workspace = r"Database Servers\DSD15_SQLEXPRESS.gds\TEST (VERSION:dbo.DEFAULT)" #r"Database Servers\DSD15_SQLEXPRESS.gds\TonyTwoWay (VERSION:dbo.DEFAULT)" #on windows use \ instead of /&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.env.overwriteOutput = True 
arcpy.env.qualifiedFieldNames = False 

#define variables for cursor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

FC = "TEST.DBO.CCAPTEST"&amp;nbsp; #pointlayer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
TaxPar = "TaxParcels" #Parcels 
poly = "ACCOUNT"#'SiteAddres_1','SiteAddres_1', 'SiteNum_1', 'SiteNumSfx_1','Predir_1','SiteStreet_1', 'StreetType_1', 'Postdir_1', 'SiteCity_1', 'SiteZIP_1', 'OwnerName_1'&amp;nbsp; 
Pnt =&amp;nbsp; "Account"# 

parcelsCount = int(arcpy.GetCount_management(FC).getOutput(0))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
dsc = arcpy.Describe(FC)&amp;nbsp; 
selection_set = dsc.FIDSet&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
if len(selection_set) == 0:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "There are no features selected"&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
elif parcelsCount &amp;gt;= 1: 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #Select parcel within selected Address Points 
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(TaxPar, "CONTAINS", FC)&amp;nbsp; &lt;/SPAN&gt;

&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # define the field list from the parcels&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFieldsList = ["ACCOUNT", poly,"SiteAddres",'SiteNum', 'SiteStreet','SiteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZIP', 'OwnerName']&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # populate the dictionary will all selected polygons
&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(TaxPar, sourceFieldsList)}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; # define the field list to the points 
&amp;nbsp;&amp;nbsp;&amp;nbsp; updateFieldsList = ["Account", Pnt,"SiteAddres", 'SiteNum', 'SiteStreet', 'SiteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZip', 'OwnerName'] 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Start an edit session. Must provide the workspace.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.Editor(arcpy.env.workspace)&amp;nbsp; as edit: 
&amp;nbsp;&amp;nbsp; 
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(FC, updateFieldsList) as updateRows:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; keyValue = updateRow[0] 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if keyValue in valueDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for n in range (1,len(sourceFieldsList)):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow&lt;N&gt; = valueDict[keyValue][n-1] &lt;/N&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&amp;nbsp; 

arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444636#M34834</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T19:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444637#M34835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard thanks for the awesome feedback and suggestions. in this situation how would i go about getting syntax to get errors reported and automated closure of the session?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried your code you posted but nothing happens the FC selected point doesn't get any updated attributes and there is no error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 15:20:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444637#M34835</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-09T15:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444638#M34836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My code automatically closes the session already, since I use the "with" syntax.&amp;nbsp; The help says "&lt;SPAN style="color: #4d4d4d; font-family: Arial, Helvetica, sans-serif; font-size: 12.8000001907349px;"&gt;The &lt;/SPAN&gt;&lt;SPAN class="arcpyref" style="font-size: 12.8000001907349px; font-family: 'Courier New', Courier, monospace; font-weight: bold; color: #4d4d4d;"&gt;with &lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Arial, Helvetica, sans-serif; font-size: 12.8000001907349px;"&gt;statements act as context managers and handle the appropriate start, stop, and abort calls for you."&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as nothing happening, have you verified that the Account of the address point and the parcel are the same before running the tool?&amp;nbsp; If not then the flaw is in the approach you are taking, not the code itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To catch errors enclose the code in a Try Except block like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;try:

### All code beginning with line 5 (indented)###

except Exception as e:&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred, print line number and error message&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; import traceback, sys&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Line %i" % tb.tb_lineno)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Line %i" % tb.tb_lineno)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(e.message)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(e.message)&lt;/PRE&gt;&lt;P&gt;If no errors get reported I will need more info about your test data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444638#M34836</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T19:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444639#M34837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i was getting the ArcMap drawing errors the request operation is invalid on a close state. I removed the "with" from line 39 and replaced with the edit = arcpy.da.Editor(arcpy.env.workspace) edit.startEditing and edit.startOperation and i did not the the close state error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did notice that for some address point the attributes were updated with the same attributes. I have attached a picture of two parcels that have different "ACCOUNT" &amp;amp; "siteNum number from each other. I select the point on south parcel and run the code and seems to run fine but then i select the address point of the parcel above and it populates with the info from the south parcel.. weird&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 17:21:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444639#M34837</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-09T17:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444640#M34838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help if you could post an image that showed the Address Points table with the updated points selected so I could see what had changed and what the point Account Numbers were.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To check what is going on with the dictionary and cursor add some print statements.&amp;nbsp; After the valueDict is created you should add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print valueDict&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after getting the keyValue assigned you should add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print keyValue&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 17:26:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444640#M34838</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-07-09T17:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444641#M34839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recreated the database and re-ran the code and it ran fine. some how the address point database got corrupted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if the address point did not an have attribute in the "Account" field this would not work because there is nothing to match with the Parcels "ACCOUNT" attribute. So would a spatial join work in a situation where the address point does not have an attribute in the "Account" field.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 18:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444641#M34839</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2015-07-09T18:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select points and update attributes base on parcels</title>
      <link>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444642#M34840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&amp;nbsp; A Spatial Join that uses the One To Many option and that makes the points the target and the parcels the join features would create a link by tracking the ObjectIDs of the point and linking it to the parcel fields in the Spatial Join output.&amp;nbsp; The Spatial Join field map should keep the parcel fields that you need and eliminate the point fields to avoid confusing you with their duplicate field names (Use Model Builder to set the field map up of the Spatial Join tool in a model and export the model to a Python script to get the field map string correct).&amp;nbsp; The TARGET_FID (point ObjectID) would be the dictionary key and would store the parcel fields captured by the Spatial Join.&amp;nbsp; The Point ObjectId would make sure the correct point is updated by the cursor and would always get the Account number of the parcel that contained it no matter what the point Account number was originally.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 18:26:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-points-and-update-attributes-base-on/m-p/444642#M34840</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2015-07-09T18:26:46Z</dc:date>
    </item>
  </channel>
</rss>

