<?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: Corner case on arcpy.CalculateField_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115091#M8992</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Josh!... try PYTHON_9.3 don't know what or if that would make a difference. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Your group should look into PRO soon, Python 3.6 is out and the support life of python 2.7 ends in 2010&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Jun 2018 01:23:59 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-06-23T01:23:59Z</dc:date>
    <item>
      <title>Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115088#M8989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey GIS experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran into a strange problem with the&amp;nbsp;&lt;EM&gt;arcpy.CalculateField_management&lt;/EM&gt; tool.&amp;nbsp;I'm not sure if this is a bug or just an error in my thinking, but I thought I'd post it just in case someone else has the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you run the commands in this order they work fine.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.MakeTableView_management(mainTable, "tableView")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.AddField_management(mainTable, "Province_Long", "TEXT", 100)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.AddJoin_management("tableView", "Province_Short", lookupTable, "Prov_Short")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.CalculateField_management("tableView","MainTable.Province_Long","!LookupTable.Prov_Long!","PYTHON")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Result are as expected (the&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;Province_Long&lt;/EM&gt; field has data in it)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If you run the commands in this order they &lt;STRONG&gt;do not&lt;/STRONG&gt; work.&lt;/P&gt;&lt;OL style="padding: 0px 0px 0px 30px;"&gt;&lt;LI style="margin: 0.2em 0px;"&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.MakeTableView_management(mainTable, "tableView")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #ff0000; font-family: terminal, monaco, monospace;"&gt;arcpy.AddJoin_management("tableView", "Province_Short", lookupTable, "Prov_Short")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0.2em 0px;"&gt;&lt;SPAN style="color: #ff0000; font-family: terminal, monaco, monospace;"&gt;arcpy.AddField_management(mainTable, "Province_Long", "TEXT", 100)&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0.2em 0px;"&gt;&lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;arcpy.CalculateField_management("tableView","MainTable.Province_Long","!LookupTable.Prov_Long!","PYTHON")&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI style="margin: 0.2em 0px;"&gt;Result are &lt;STRONG&gt;not&lt;/STRONG&gt;&amp;nbsp;as expected (the&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;Province_Long&lt;/EM&gt;&amp;nbsp;field has no data in it)&lt;BR /&gt;No error is thrown, meaning that the field &lt;SPAN&gt;&lt;EM&gt;Province_Long&lt;/EM&gt; exists and can be found, but for some reason the data is not being retrieved from the joined table. This only occurs when you are calculated from a field from the joined table.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also built a stand-alone script if someone wants to replicate the issue on their end. To change the script from not working to working, swap the two lines of code under &lt;SPAN style="font-family: terminal, monaco, monospace;"&gt;#Swap these two lines&lt;/SPAN&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; arcview
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="comment token"&gt;#=====Allow overwrite=====&lt;/SPAN&gt;
originalOverwriteOutput &lt;SPAN class="operator 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
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;

&lt;SPAN class="comment token"&gt;#=====Build main table=====&lt;/SPAN&gt;
mainTable&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateTable_management&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;scratchGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MainTable"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Province_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&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;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Province_Short"&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"123 Sesame Street"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ON"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"10 Downing Street"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"221B Baker Street"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"QC"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"4 Privet Drive"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"BC"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;SPAN class="comment token"&gt;#=====Build lookup table=====&lt;/SPAN&gt;
lookupTable&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateTable_management&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;scratchGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LookupTable"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lookupTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prov_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lookupTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prov_Long"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&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;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lookupTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prov_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prov_Long"&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NL"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Newfoundland and Labrador"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"PE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Prince Edward Island"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Nova Scotia"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NB"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"New Brunswick"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"QC"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Quebec"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ON"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Ontario"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"MB"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Manitoba"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"SK"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Saskatchewan"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"AB"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Alberta"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"BC"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"British Columbia"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"YT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Yukon"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Northwest Territories"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"NU"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Nunavut"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="comment token"&gt;#=====Run lookup=====&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeTableView_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"tableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#==================================================&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#Swap these two lines&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddJoin_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Province_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lookupTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prov_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#If this line is first, calc field does nothing&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Province_Long"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#If this line is first, it works properly&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#==================================================&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tableView"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"MainTable.Province_Long"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"!LookupTable.Prov_Long!"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"PYTHON"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#=====Print output=====&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;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mainTable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Address"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Province_Short"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Province_Long"&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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;"Address: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;", Province_Short: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;", Province_Long: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Address: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;", Province_Short: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;", Province_Long: "&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&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="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#=====Reset overwrite=====&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; originalOverwriteOutput‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/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;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/411902_Results.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:48:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115088#M8989</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-11T06:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115089#M8990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What product (ArcGIS Pro or ArcMap) and what version are you running?&amp;nbsp; I just ran your script on ArcMap 10.6, and I get the same correct answers regardless of which line is first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2018 16:43:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115089#M8990</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-21T16:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115090#M8991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Bixby,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using ArcMap 10.4.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for testing it out! I guess it's not an issue anymore.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2018 17:00:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115090#M8991</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2018-06-21T17:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115091#M8992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Josh!... try PYTHON_9.3 don't know what or if that would make a difference. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Your group should look into PRO soon, Python 3.6 is out and the support life of python 2.7 ends in 2010&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jun 2018 01:23:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115091#M8992</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-23T01:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115092#M8993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Dan! Thanks for replying &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; I've tried PYTHON_9.3, same problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sounds like it's time for PRO...I guess that means my education has become dated&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;P&gt;(also I think 2010 was a type. Looks like 2.7 support ends in 2020)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 19:36:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115092#M8993</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2018-06-27T19:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Corner case on arcpy.CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115093#M8994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;support ends... but don't expect anything new beyond a fix...&lt;/P&gt;&lt;P&gt;Besides python 3.8 is in development.. it is almost time for the 4.0 series &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, 28 Jun 2018 03:40:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/corner-case-on-arcpy-calculatefield-management/m-p/115093#M8994</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-28T03:40:06Z</dc:date>
    </item>
  </channel>
</rss>

