<?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: error: 9999999 the field is not nullable in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643191#M50154</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would also recommend throwing in a &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;print cost1&lt;/SPAN&gt;&lt;SPAN&gt; before the &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;CalculateField_management&lt;/SPAN&gt;&lt;SPAN&gt; line just to check what value you are trying to insert.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jun 2014 18:40:05 GMT</pubDate>
    <dc:creator>JoshuaChisholm</dc:creator>
    <dc:date>2014-06-04T18:40:05Z</dc:date>
    <item>
      <title>error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643189#M50152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have this python stand alone script wich is runing fine until gets to this part. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;if gp.Exists(lcp_name+".shp") == 0: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CostPath_sa("samp_lyr", cd_name, bl_name, "cost_path", "BEST_SINGLE", "")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Export the cost of the LCP &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vat = gp.searchcursor("cost_path") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_n = vat.next() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cost1_list = [] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while row_n: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cost1_list.append(row_n.pathcost) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row_n = vat.next() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cost1 = sum(cost1_list) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del vat, row_n, cost1_list&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Turns the raster LCP to a polyline &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.RasterToPolyline_conversion("cost_path","temp.shp", "ZERO", "", "SIMPLIFY") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Dissolve_management("temp.shp", lcp_name+".shp") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.delete_management("temp.shp") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.delete_management("cost_path")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Calculate the length of the LCP. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Addfield_management(lcp_name+".shp", "LENGTH", "DOUBLE") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management(lcp_name+".shp", "LENGTH", "float(!SHAPE.LENGTH!)", "PYTHON") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.Addfield_management(lcp_name+".shp", "COST", "DOUBLE") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management(lcp_name+".shp", "COST", cost1, "PYTHON")&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error I get is: arcgisscripting.ExecuteError: Error 9999999: Error executing function. The field is not nullable. [COST]. Failed to execute &amp;lt;Calculate field&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It creates the field "cost" but doesn't fill it. In ArcMap I open the shape and I'm able to fill it with zero value so I don't understand the error.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 16:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643189#M50152</guid>
      <dc:creator>JuanSerratosa_López</dc:creator>
      <dc:date>2014-06-04T16:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643190#M50153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcGIS version? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using 10.0 or later, I highly recommend using arcpy, and using the PYTHON_9.3 parser.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/Calculate_Field_examples/00170000004s000000/"&gt;10.0 - Calculate Field Exmples (Code samples--geometry)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, it's a good idea to avoid field names that are reserved words in SQL (i.e. LENGTH)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 18:01:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643190#M50153</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-06-04T18:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643191#M50154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would also recommend throwing in a &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;print cost1&lt;/SPAN&gt;&lt;SPAN&gt; before the &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;CalculateField_management&lt;/SPAN&gt;&lt;SPAN&gt; line just to check what value you are trying to insert.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 18:40:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643191#M50154</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-06-04T18:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643192#M50155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try casting to string:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.CalculateField_management(lcp_name+".shp", "COST", str(cost1), "PYTHON")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 18:55:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643192#M50155</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2014-06-04T18:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643193#M50156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a section of a much bigger code that was made for ArcGIS 9.3 and Python 2.5, I'm trying to run it from ArcGIS 10.1 and Python 2.7. So this must be the problem in general...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I tried what jscheirer suggested and it worked!!! Now the field gets populated with the correct information!! Thanks a lot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately the script stops without doing the last operation wich is to populate one single table with all this information.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I'll have to make a new post later... hehehehe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for your advice and help!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 20:11:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643193#M50156</guid>
      <dc:creator>JuanSerratosa_López</dc:creator>
      <dc:date>2014-06-04T20:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643194#M50157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Juan, I'm happy you got it working!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To help out the forums and future readers, I've marked Jason's response with a green check.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 16:23:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643194#M50157</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-06-05T16:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: error: 9999999 the field is not nullable</title>
      <link>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643195#M50158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Joshua! I tried to mark it yesterday but couldn't...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 22:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-9999999-the-field-is-not-nullable/m-p/643195#M50158</guid>
      <dc:creator>JuanSerratosa_López</dc:creator>
      <dc:date>2014-06-05T22:52:58Z</dc:date>
    </item>
  </channel>
</rss>

