<?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 Trying to write a python script to access data from attribute tables in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223726#M12686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks. I'm new to both GIS and programming and am attempting to combine the two. I need a python script that will read down a particular column of the attribute table of a particular layer, then check it against a column in the attribute table of another layer. Both of these columns will contain strings. If the two match, then the script should input "YES" into another field in the first layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I honestly have no idea how to even start this. I've read through esri's help section and have a very basic grasp of python but I'm unsure of how to get the script to actually access the attribute tables. Any help would be very greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance! If there's a better place to post this, please let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jul 2014 16:28:44 GMT</pubDate>
    <dc:creator>ThomasCaruso</dc:creator>
    <dc:date>2014-07-22T16:28:44Z</dc:date>
    <item>
      <title>Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223726#M12686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks. I'm new to both GIS and programming and am attempting to combine the two. I need a python script that will read down a particular column of the attribute table of a particular layer, then check it against a column in the attribute table of another layer. Both of these columns will contain strings. If the two match, then the script should input "YES" into another field in the first layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I honestly have no idea how to even start this. I've read through esri's help section and have a very basic grasp of python but I'm unsure of how to get the script to actually access the attribute tables. Any help would be very greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance! If there's a better place to post this, please let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 16:28:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223726#M12686</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-22T16:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223727#M12687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you read the sections and seen the code examples in the "cursors" sections of the help file?&amp;nbsp; There are search cursors update cursors.&amp;nbsp; Other sections on fields, queries etc. and their code examples will get you off to a good start.&amp;nbsp; Also examining code snippets produced by other individuals, if you can find them on this site, will also serve you well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 16:33:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223727#M12687</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-22T16:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223728#M12688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just about to read up on cursors, I'm sure that will help. Thanks for the advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I may ask another question, is there a way to write a script that will spatially check the location of a point in one layer, to see if it's in a polygon in another layer and then check two fields in each of their attribute tables to see if they match? For example, I have two layers, one with a point where a water well was drilled, and one with county parcel data. I would want the script to see which parcel the well point is on, and then see if the name of the well owner and the name of the parcel owner match. Is this significantly more or less difficult than my original script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 16:53:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223728#M12688</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-22T16:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223729#M12689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be very easy if you are using FME (&lt;A href="http://www.safe.com/"&gt;www.safe.com&lt;/A&gt;), no programming needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the following transformers: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/featuremerger.htm"&gt;FeatureMerger&lt;/A&gt;&lt;/STRONG&gt; to identify matched records, &lt;STRONG&gt;&lt;A href="http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/attributecreator.htm%3FTocPath%3DFME%20Transformers%7CAll%20Workbench%20Transformers%7C_____37"&gt;AttributeCreator&lt;/A&gt;&lt;/STRONG&gt; for MERGED and NOT_MERGED with Yes and No, respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/spatialfilter.htm%3FTocPath%3DFME%20Transformers%7CAll%20Workbench%20Transformers%7C_____382"&gt;SpatilalFilter&lt;/A&gt; &lt;/STRONG&gt; to identify the spatial relationships.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 17:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223729#M12689</guid>
      <dc:creator>JeffreyVu</dc:creator>
      <dc:date>2014-07-22T17:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223730#M12690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so....is this even remotely correct? Am I even close to being on the right track?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wells = "path here"&lt;BR /&gt;parcels = "path here"&lt;BR /&gt;owner = ["Owner"]&lt;BR /&gt;powner = ["Owner1"]&lt;BR /&gt;cursor = arcpy.da.UpdateCursor(wells, ["Public"])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wellowner = arcpy.da.SearchCursor(wells, owner)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parcelowner = arcpy.da.SearchCursor(parcels, powner)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( wellowner == parcelowner ) : &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = YES&lt;/P&gt;&lt;P&gt;else row = cursor.next()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 19:39:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223730#M12690</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-22T19:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223731#M12691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to know which parcel the well point is on, why not do a spatial join first, that way you only need to iterate over 1 attribute table, after you do the spatial join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00080000000q000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//00080000000q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to add another field to your points, so you can put "YES" it in.‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way you should only need 1 search cursor, which will need the the field names for the well owner, parcel owner, and field name that will contain the "Yes".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so after doing a spatial join and adding your new field it would look something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy





wells = "path here"





wellowner&amp;nbsp; = "Owner" #or whatever your field name is


parcelowner = "Owner1" #or whatever your field name is





with arcpy.da.UpdateCursor(wells, [wellowner, parcelowner, "Nameofyournewfieldhere"]) as cursor:


&amp;nbsp; for row in cursor:


&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[0] == row[1]:


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = "YES"


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)


&amp;nbsp;&amp;nbsp;&amp;nbsp; else:


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You did pretty well with your code, cursors can take a little while to get use to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A little critique of your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy #perfect!





wells = "path here" #good
parcels = "path here" # good
owner = ["Owner"] #no brackets needed, you want a string not a list(though it turns out okay in this case)
powner = ["Owner1"] #see above
cursor = arcpy.da.UpdateCursor(wells, ["Public"]) #correct syntax for making a cursor, kudos for using the data access cursor





wellowner = arcpy.da.SearchCursor(wells, owner) #again correct syntax





parcelowner = arcpy.da.SearchCursor(parcels, powner)#ditto





if ( wellowner == parcelowner ) : #here would be the problem, you are comparing two cursor objects and not their values
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: #correct syntax for accessing your update cursor object 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = YES #would be row[indexvalueofyourfield] See my example


else row = cursor.next()

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A good attempt for a first time, I would recommend trying some of their sample code first to get use to the syntax and outputs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223731#M12691</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2021-12-11T10:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223732#M12692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not bad for a first crack!!!&amp;nbsp; See Ian's example below&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 20:27:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223732#M12692</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-22T20:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223733#M12693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for taking the time to critique my code! Your help is greatly appreciated. I'm going to try to correct my code later today, although your method of doing the spatial join seems &lt;EM&gt;much&lt;/EM&gt; easier, so I'm trying that route right now. When I run the code, though, I get a runtime error- it says that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file "&amp;lt;string&amp;gt;", line 9, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;runtimeerror: workspace or data source is read only&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think part of my problem might be that I've had trouble setting the path properly. All the examples on the arcgis help have a .gdb file in the path, like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n"&gt;fc&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s"&gt;"c:/data/base.gdb/roads"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;this is the path I'm trying to use:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;"P:/sections/Residential Sanitation/EHS-net Private Well Project/GIS - Work/Individual County Maps/Tom/WellParcelLoc.shp"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;is it because I'm trying to access the shapefile and not a .gdb (I don't even know what that is, nor do I see that file anywhere near my shapefile) that I'm getting this read-only error?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="s"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:14:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223733#M12693</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T14:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223734#M12694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the kind words! I'll only get better with more practice and experience. Thanks again for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223734#M12694</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T14:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223735#M12695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did this code work as you planned it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so did you incorporate it as a script tool in a model, use field calculator, run it using the "Python" window in ArcMap, or as a standalone python script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been trying to learn scripting as well but I am confused on the best place to incorporate it into the working MXD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;Dan Amrine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:25:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223735#M12695</guid>
      <dc:creator>DanielAmrine</dc:creator>
      <dc:date>2014-07-23T14:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223736#M12696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been doing everything in the python window. Unfortunately I have only a basic version of ArcGIS so I don't believe I have the capability to add models, although I might get an upgraded version once I show I have the abilities to actually use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm still trying to get it to work properly, but I'm close. The help I've recieved here has been absolutely invaluable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: I've been using the method that was recommended to me by Ian above, while I'm going to try to get my code to work properly I've realized that my methodology was not the best way to go about handling the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223736#M12696</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T14:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223737#M12697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My first bed would be to change the file location to a place without special signs in it (like " ","-"). Some geoprocessing tools do not like these.&lt;/P&gt;&lt;P&gt;If the shapefile is viewed in any ESRI application like ArcMap or ArcCatalog it could be locked - this could result in a similar error. ESRI Applications are not good in deleting these locks after you are finished with the file - I had to close every ESRI app to get rid of the lock sometimes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:35:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223737#M12697</guid>
      <dc:creator>FlorianHoedt2</dc:creator>
      <dc:date>2014-07-23T14:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223738#M12698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Upon closer inspection, when I view the shapefile and other files when Arcmap opens, it also creates (for as long as arcmap is open) a "LOCK" file. I assume this means that I need to run the script without arcmap open, but how can I do that? Could I use the command prompt in windows?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:52:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223738#M12698</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T14:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223739#M12699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, sans-serif;"&gt;If you import arcpy you could run it from cmd.exe (commandline) or idle the integrated python ide.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif;"&gt;You also could run the code via python window from arcCatalog but you should not have the catalogs cursor on the file than.&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif;"&gt;Hope it helps &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 15:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223739#M12699</guid>
      <dc:creator>FlorianHoedt2</dc:creator>
      <dc:date>2014-07-23T15:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223740#M12700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Python is already on your computer, since you have ArcGIS it comes with Python 2.7 (or 2.6).&amp;nbsp; You can just copy and paste the code I used into any text editor and save it as a .py file extension, and your computer should be able to run it by double clicking on it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lock file exists when you open ArcMap to prevent edits being made if the file is being accessed more than once(you have multiple maps open with that data, multipler users are using the same data, etc.).&amp;nbsp; The code should work in the ArcMap python window, but might not if the map is open and the program is being run outside of ArcMap, since it is updating values, not just reading them. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 15:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223740#M12700</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-07-23T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223741#M12701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I realized that part of the data that I used to make the join was data that I technically was not able to write. I copied it to a place where I could write and re-did the join, now the code works perfectly! Thank you so much. Unfortunately the names, I realize, are not in the same format or even capitalized the same way so now I'm trying to use the field calculator to split the names with a space as a delimiter, for whatever reason it gets the first names no problem but won't separate out the last names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the "OwnerFirst" and "OwnerLast" fields, I used..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OwnerFirst = !Owner!.split(" ")[0]&lt;/P&gt;&lt;P&gt;OwnerLast is the same but with a [1]. It got ~100 of the 2k last names out, but skipped some and I can't quite figure out why.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 16:23:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223741#M12701</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T16:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223742#M12702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please give us some example names for a) working and b) not working so we could figure out what is wrong with your approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 17:14:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223742#M12702</guid>
      <dc:creator>FlorianHoedt2</dc:creator>
      <dc:date>2014-07-23T17:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223743#M12703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;This is what's really been confusing me. There doesn't seem to be any rhyme or reason. For example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike Crane was split perfectly fine, Bob Wyant, Bernie Vossler, Sherwood Lidermore all fine. But Tod Shaw, John Markel, Chris Mendell did not split. I checked to see if the ones that split had a space after their last name, but they didn't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore, some people who had three names or a middle initial did or didn't split, like "Paul And Anna Marie" gave me Paul And, but Rod And Cindy just gave me Rod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error messages I got were:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Executing: calculate field wellparcelloc OwnerLast !Owner!.split(" ")[1] PYTHON_9.3#&lt;/P&gt;&lt;P&gt;ERROR 000539: Error running expression: u"MINNEKINE".split(" ")[1]&lt;/P&gt;&lt;P&gt;traceback:&lt;/P&gt;&lt;P&gt;file "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 17:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223743#M12703</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T17:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223744#M12704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;EM&gt;ERROR 000539: Error running expression: u"MINNEKINE".split(" ")[1]&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;EM&gt;traceback:&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;EM&gt;file "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;EM&gt;IndexError: list index out of range&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;'MINNEKINE' is the string which should be split by ' ' (space), but it has no space. Therefore the list which is returned has no second (list[1]) entry -&amp;gt; index out of range.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Seems like you have OWNER values which have no space as seperator, why? Do you perform any other method on !OWNER! before putting it into split()?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 17:53:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223744#M12704</guid>
      <dc:creator>FlorianHoedt2</dc:creator>
      <dc:date>2014-07-23T17:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to write a python script to access data from attribute tables</title>
      <link>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223745#M12705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, this split is the only method being performed. Would running into a single string without a space stop the whole process?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 18:04:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/trying-to-write-a-python-script-to-access-data/m-p/223745#M12705</guid>
      <dc:creator>ThomasCaruso</dc:creator>
      <dc:date>2014-07-23T18:04:02Z</dc:date>
    </item>
  </channel>
</rss>

