Hi I am trying to run the following script from py 2.7 IDLE that comes with ArcMap 10.7.1. When I try to run the following script:
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> os
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">from</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa <SPAN class="keyword token">import</SPAN> <SPAN class="operator token">*</SPAN>
<SPAN class="comment token">#Set the evironment settings</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'D:\Spring2020\VIC\PCA_Reclass_2004\PCA_Reclass_04'</SPAN>
<SPAN class="comment token">#Load the rasters</SPAN>
folder <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'D:\Spring2020\VIC\PCA_Reclass_2004\PCA_Reclass_04'</SPAN>
rasters <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListRasters<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"TIF"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> rasters
inpoly <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'D:\Spring2020\VIC\EB_Correct_File_ArcGIS\VIC.shp'</SPAN>
out <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'D:\Spring2020\VIC\EB_Correct_File_ArcGIS'</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>field<SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">for</SPAN> field <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN>inpoly<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
cursor<SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>inpoly<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'GRID_CODE'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> cursor
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>inpoly<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'GRID_CODE'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token">#print row</SPAN>
<SPAN class="keyword token">for</SPAN> raster <SPAN class="keyword token">in</SPAN> rasters<SPAN class="punctuation token">:</SPAN>
out <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>out<SPAN class="punctuation token">,</SPAN> raster <SPAN class="operator token">+</SPAN> <SPAN class="string token">".dbf"</SPAN><SPAN class="punctuation token">)</SPAN>
outT<SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>gp<SPAN class="punctuation token">.</SPAN>ZonalStatisticsAsTable<SPAN class="punctuation token">(</SPAN>inpoly<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"GRID_CODE"</SPAN><SPAN class="punctuation token">,</SPAN>raster<SPAN class="punctuation token">,</SPAN> out<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DATA"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'MEAN'</SPAN><SPAN class="punctuation token">)</SPAN>
I get the following error <SPAN class="punctuation token">(</SPAN>even though I have the license <SPAN class="operator token">and</SPAN> can use the tool <SPAN class="keyword token">in</SPAN> ArcMap<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
raceback <SPAN class="punctuation token">(</SPAN>most recent call last<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
File <SPAN class="string token">"D:/Spring2020/VIC/zonal_stats_Table.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">21</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN>module<SPAN class="operator token">></SPAN>
outT<SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>gp<SPAN class="punctuation token">.</SPAN>ZonalStatisticsAsTable<SPAN class="punctuation token">(</SPAN>inpoly<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"GRID_CODE"</SPAN><SPAN class="punctuation token">,</SPAN>raster<SPAN class="punctuation token">,</SPAN> out<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DATA"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'MEAN'</SPAN><SPAN class="punctuation token">)</SPAN>
File <SPAN class="string token">"C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\geoprocessing\_base.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">510</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN><SPAN class="keyword token">lambda</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">lambda</SPAN> <SPAN class="operator token">*</SPAN>args<SPAN class="punctuation token">:</SPAN> val<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN>gp_fixargs<SPAN class="punctuation token">(</SPAN>args<SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
ExecuteError<SPAN class="punctuation token">:</SPAN> Failed to execute<SPAN class="punctuation token">.</SPAN> Parameters are <SPAN class="operator token">not</SPAN> valid<SPAN class="punctuation token">.</SPAN>
ERROR <SPAN class="number token">000824</SPAN><SPAN class="punctuation token">:</SPAN> The tool <SPAN class="keyword token">is</SPAN> <SPAN class="operator token">not</SPAN> licensed<SPAN class="punctuation token">.</SPAN>
Failed to execute <SPAN class="punctuation token">(</SPAN>ZonalStatisticsAsTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>