<?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: TypeError in UpdateCursor query in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173032#M13338</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Had to think a little bit (I'm taking baby steps with this...) but yes, it did work once I realized I needed to use row[1] instead of 0 because that is where some null values are. Thanks again for the help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Feb 2020 19:58:45 GMT</pubDate>
    <dc:creator>SaraJK</dc:creator>
    <dc:date>2020-02-18T19:58:45Z</dc:date>
    <item>
      <title>TypeError in UpdateCursor query</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173028#M13334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The script I am writing is simply to query multiple fields based on certain criteria and then assign a value to another field. I have multiple queries that need to be built. This is just the beginning as I am stepping into it slowly.&amp;nbsp;This is literally the first script I've tried to write. I started working in Pro 2.4 which is where I am getting the TypeError. I tried it in ArcMap 10.5.1 and it ran fine. After researching a bit, I think it has something to do with changes between Python 2 and 3 but I am not sure. Field 0 is a short data type, Field 1 is a long data type and Field 2 is text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has a suggestion on how to make it work in Pro, I would&amp;nbsp;appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;fc = r"K:\PHYS\PROJECTS\LTSTest.gdb\Streets"
fields = ['LOCAL_SPEED_MPH', 'AADT_NBR', 'TestLTS']
with &lt;/SPAN&gt;arcpy.da.UpdateCursor(fc,fields) &lt;SPAN style="color: #000080; font-weight: bold;"&gt;as &lt;/SPAN&gt;cursor:
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;row &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;cursor:
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(row[&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #0000ff;"&gt;25 &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;or &lt;/SPAN&gt;row[&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #0000ff;"&gt;1500&lt;/SPAN&gt;):
            row[&lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;] = &lt;SPAN style="color: #0000ff;"&gt;1
&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;elif &lt;/SPAN&gt;(row [&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;] &amp;gt; &lt;SPAN style="color: #0000ff;"&gt;40&lt;/SPAN&gt;):
            row[&lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;] = &lt;SPAN style="color: #0000ff;"&gt;2
&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;        &lt;/SPAN&gt;cursor.updateRow(row)
    print(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Done"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;# Traceback (most recent call last):
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;#   File "&amp;lt;string&amp;gt;", line 3, in &amp;lt;module&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# TypeError: '&amp;lt;=' not supported between instances of 'NoneType' and 'int'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:56:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173028#M13334</guid>
      <dc:creator>SaraJK</dc:creator>
      <dc:date>2021-12-11T08:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError in UpdateCursor query</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173029#M13335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You hit a null value in your table, you have to skip those records&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 13.0667px;"&gt;for &lt;/SPAN&gt;row &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 13.0667px;"&gt;in &lt;/SPAN&gt;cursor:
    if row[0] is Null:
        continue
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 13.0667px;"&gt;if &lt;/SPAN&gt;(row[&lt;SPAN style="color: #0000ff; border: 0px; font-weight: inherit; font-size: 13.0667px;"&gt;0&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #0000ff; border: 0px; font-weight: inherit; font-size: 13.0667px;"&gt;25 &lt;/SPAN&gt;&lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 13.0667px;"&gt;or &lt;/SPAN&gt;row[&lt;SPAN style="color: #0000ff; border: 0px; font-weight: inherit; font-size: 13.0667px;"&gt;1&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #0000ff; border: 0px; font-weight: inherit; font-size: 13.0667px;"&gt;1500&lt;/SPAN&gt;):&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting" target="_blank"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp; will help with formatting and line numbers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:57:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173029#M13335</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError in UpdateCursor query</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173030#M13336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Thanks for the quick reply and formatting help (I couldn't figure out how to do it in the first post).&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;I added the code you suggested but it came back as "NameError: name 'Null' is not defined" so I changed it to None which seemed to go through. Now, it's back to the same error as before.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2020 20:13:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173030#M13336</guid>
      <dc:creator>SaraJK</dc:creator>
      <dc:date>2020-02-14T20:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError in UpdateCursor query</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173031#M13337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, it should have been None..&lt;/P&gt;&lt;P&gt;So that suggests that there is None in your other field so try&lt;/P&gt;&lt;P&gt;if row[0] is None or row[1] is None:&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;if None in row:&amp;nbsp; # think this should work,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, just open the table and query your field for &amp;lt;null&amp;gt; (aka, None), to see what you are dealing with&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2020 21:32:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173031#M13337</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-02-14T21:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError in UpdateCursor query</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173032#M13338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Had to think a little bit (I'm taking baby steps with this...) but yes, it did work once I realized I needed to use row[1] instead of 0 because that is where some null values are. Thanks again for the help.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:58:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-in-updatecursor-query/m-p/173032#M13338</guid>
      <dc:creator>SaraJK</dc:creator>
      <dc:date>2020-02-18T19:58:45Z</dc:date>
    </item>
  </channel>
</rss>

