<?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 errors in New to GIS Questions</title>
    <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740360#M1942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have found some errors but im sure not everything. what errors can you see in these?&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;env.workspace = "C:/EsriPress/Python/Data/Exercise07"&lt;/P&gt;&lt;P&gt;FC = "airports.shp" rows = arcpy.SearchCursor(fc)&lt;/P&gt;&lt;P&gt;fields = arcpy.ListFields(fc)&lt;/P&gt;&lt;P&gt;for field in fields:&lt;/P&gt;&lt;P&gt;if fields.name == "NAME"&lt;/P&gt;&lt;P&gt;for row in rows:&lt;/P&gt;&lt;P&gt;print "Name = {0}".format(row.getValue(field.name))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;env.workspace = "C:/EsriPress/Python/Data\Exercise09"&lt;/P&gt;&lt;P&gt;raster = "landcover.tiff"&lt;/P&gt;&lt;P&gt;desc = arcpy.describe(raster)&lt;/P&gt;&lt;P&gt;x = desc.MeanCellHeight&lt;/P&gt;&lt;P&gt;y = desc.MeanCellWidth&lt;/P&gt;&lt;P&gt;spatialref = desc.spatialReference&lt;/P&gt;&lt;P&gt;units = spatialref.linearUnitName&lt;/P&gt;&lt;P&gt;print "Cells are" + str(x) + " by " + str(y) + " " + units + "."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 21 Mar 2020 15:00:21 GMT</pubDate>
    <dc:creator>CNRFGN</dc:creator>
    <dc:date>2020-03-21T15:00:21Z</dc:date>
    <item>
      <title>errors</title>
      <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740360#M1942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have found some errors but im sure not everything. what errors can you see in these?&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;env.workspace = "C:/EsriPress/Python/Data/Exercise07"&lt;/P&gt;&lt;P&gt;FC = "airports.shp" rows = arcpy.SearchCursor(fc)&lt;/P&gt;&lt;P&gt;fields = arcpy.ListFields(fc)&lt;/P&gt;&lt;P&gt;for field in fields:&lt;/P&gt;&lt;P&gt;if fields.name == "NAME"&lt;/P&gt;&lt;P&gt;for row in rows:&lt;/P&gt;&lt;P&gt;print "Name = {0}".format(row.getValue(field.name))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;env.workspace = "C:/EsriPress/Python/Data\Exercise09"&lt;/P&gt;&lt;P&gt;raster = "landcover.tiff"&lt;/P&gt;&lt;P&gt;desc = arcpy.describe(raster)&lt;/P&gt;&lt;P&gt;x = desc.MeanCellHeight&lt;/P&gt;&lt;P&gt;y = desc.MeanCellWidth&lt;/P&gt;&lt;P&gt;spatialref = desc.spatialReference&lt;/P&gt;&lt;P&gt;units = spatialref.linearUnitName&lt;/P&gt;&lt;P&gt;print "Cells are" + str(x) + " by " + str(y) + " " + units + "."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 15:00:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740360#M1942</guid>
      <dc:creator>CNRFGN</dc:creator>
      <dc:date>2020-03-21T15:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: errors</title>
      <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740361#M1943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try following steps in this link to present your code block:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet"&gt;https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you also show the error messages that you are getting?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 15:13:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740361#M1943</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2020-03-21T15:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: errors</title>
      <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740362#M1944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;its an exercise i didnt create these scripts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 15:23:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740362#M1944</guid>
      <dc:creator>CNRFGN</dc:creator>
      <dc:date>2020-03-21T15:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: errors</title>
      <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740363#M1945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Show your results, someone else's samples aren't going to help if you don't have error messages.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Mar 2020 15:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740363#M1945</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-21T15:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: errors</title>
      <link>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740364#M1946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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="comment token"&gt;#from arcpy import env&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#i prefer to be explicit in module use&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#use raw formatting&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; r&lt;SPAN class="string token"&gt;"C:/EsriPress/Python/Data/Exercise07"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#lower case&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#is this in the workspace? if not use a full path&lt;/SPAN&gt;
fc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"airports.shp"&lt;/SPAN&gt; 

&lt;SPAN class="comment token"&gt;#arcpy.da.searchcursor is best&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#rows = arcpy.SearchCursor(fc)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#fields = arcpy.ListFields(fc)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#for field in fields:&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#if fields.name == "NAME"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#for row in rows:&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#print "Name = {0}".format(row.getValue(field.name))&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;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCusor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NAME"&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="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Name = "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;except&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;"No field 'NAME' found"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;break&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:30:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/new-to-gis-questions/errors/m-p/740364#M1946</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-12-12T07:30:47Z</dc:date>
    </item>
  </channel>
</rss>

