{"id":633,"date":"2015-02-12T12:35:34","date_gmt":"2015-02-12T12:35:34","guid":{"rendered":"https:\/\/grindgis.com\/?p=633"},"modified":"2015-08-12T01:02:56","modified_gmt":"2015-08-12T01:02:56","slug":"python-license-error-000824","status":"publish","type":"post","link":"https:\/\/grindgis.com\/?p=633","title":{"rendered":"Python License Error &#8211; 000824, Running code for Spatial Analyst or 3D Analyst"},"content":{"rendered":"<p><span style=\"color: #333333; font-family: Georgia;\">I was trying to create the contour line from the PhytonGUI but failed to create it. It keep on showing me the error &#8211; 000824. Below code generates 25 m interval contour using spatial analyst but only inside ArcGis command window. It did not work outside Arcgis because I was missing important code to add. Python is a high level programming l<\/span>anguage\u00a0that you can use to automate the work in the Arcgis. Here is the <a title=\"Free Python Course for GIS Users from coursera.org\" href=\"https:\/\/grindgis.com\/blog\/free-python-course-for-gis-users-from-coursera-org\" target=\"_blank\">free course<\/a>\u00a0on the python.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #44546a; font-family: Georgia;\"><em>import arcpy<\/em><br \/>\n<\/span><\/p>\n<p><span style=\"color: #44546a; font-family: Georgia;\"><em>demPath = &#8220;C:\/GIS Master Program\/2nd Semester\/GIS 570\/Lesson 1\/folder\/foxlake&#8221;<\/em><br \/>\n<\/span><\/p>\n<p><span style=\"color: #44546a; font-family: Georgia;\"><em>contourPath = &#8220;C:\/GIS Master Program\/2nd Semester\/GIS 570\/Lesson 1\/homework\/task1\/practice\/contour4.shp&#8221;<\/em><br \/>\n<\/span><\/p>\n<p><span style=\"color: #44546a; font-family: Georgia;\"><em>arcpy.gp.Contour_sa(demPath,contourPath,&#8221;25&#8243;,&#8221;0&#8243;,&#8221;1&#8243;)<\/em><br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #00b050; font-family: Georgia;\"><strong>And I got the below message,<\/strong><br \/>\n<\/span><\/p>\n<p><span style=\"color: #0070c0; font-family: Georgia;\"><em>Traceback (most recent call last):<\/em><br \/>\n<em>File &#8220;C:\/GIS Master Program\/2nd Semester\/GIS 570\/Lesson 1\/homework\/test&#8221;, line 4, in &lt;module&gt;<\/em><br \/>\n<em>arcpy.gp.Contour_sa(demPath,contourPath,&#8221;25&#8243;,&#8221;0&#8243;,&#8221;1&#8243;)<\/em><br \/>\n<em>File &#8220;C:\\Program Files (x86)\\ArcGIS\\Desktop10.2\\arcpy\\arcpy\\geoprocessing\\_base.py&#8221;, line 498, in &lt;lambda&gt;<\/em><br \/>\n<em>return lambda *args: val(*gp_fixargs(args, True))<\/em><br \/>\n<em>ExecuteError: Failed to execute. Parameters are not valid.<\/em><br \/>\n<strong><em>ERROR 000824: The tool is not licensed.<\/em><\/strong><br \/>\n<em>Failed to execute (Contour).<\/em><br \/>\n<\/span><\/p>\n<p><span style=\"color: red; font-family: Georgia;\">So it was the Error 000824<br \/>\n<\/span><\/p>\n<p><span style=\"color: red; font-family: Georgia;\">After doing so much Google search finally found the answer that we have turn on extension within the code. So to turn on spatial Analyst code will be<br \/>\n<\/span><\/p>\n<p><span style=\"color: red; font-family: Georgia; font-size: 12pt; background-color: white;\"><strong>gp.CheckOutExtension(&#8220;Spatial&#8221;)<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #00b050; font-family: Georgia; font-size: 10pt; background-color: white;\"><strong>Finally code that did run is.<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em># The following code will create 25 metres contour from Foxlake Dem<br \/>\n<\/em><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em>import arcpy, arcinfo<br \/>\n<\/em><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em>arcpy.CheckOutExtension(&#8220;spatial&#8221;)<br \/>\n<\/em><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em>demPath = &#8220;C:\/GIS Master Program\/2nd Semester\/GIS 570\/Lesson 1\/folder\/foxlake&#8221;<br \/>\n<\/em><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em>contourPath = &#8220;C:\/GIS Master Program\/2nd Semester\/GIS 570\/Lesson 1\/homework\/task1\/practice\/contour4.shp&#8221;<br \/>\n<\/em><\/span><\/p>\n<p><span style=\"color: #323e4f;\"><em>arcpy.gp.Contour_sa(demPath,contourPath,&#8221;25&#8243;,&#8221;0&#8243;,&#8221;1&#8243;)<br \/>\n<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to create the contour line from the PhytonGUI but failed to create it. It keep on showing me the error &#8211; 000824. Below code generates 25 m interval contour using spatial analyst but only inside ArcGis command window. It did not work outside Arcgis because I was missing important code to add. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":642,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,135,29,104],"tags":[141,31,143,138,144,140,142,69,63,136,139,137],"class_list":["post-633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arcgis","category-python","category-software","category-tutorials","tag-141","tag-arcgis","tag-arcinfo","tag-arcpy","tag-contour","tag-error","tag-error-000824","tag-programming","tag-python","tag-python-code","tag-python-gui","tag-spatial-analyst","entry","has-media"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts\/633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=633"}],"version-history":[{"count":0,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts\/633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/media\/642"}],"wp:attachment":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}