Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using python I'm having problems when trying to attempt a FOR LOOP with the ZonalHistogram function of ArcGIS 10.1. It works fine if I use it only for one image but it gives me this error while for looping:

ExecuteError: ERROR 999999: Error executing function.
Create output table failed
Failed to execute (ZonalHistogram)

Here is my very simple script:

import arcpy
from import *

arcpy.env.workspace = 'G:\\Chile_2012\\MODIS10A2.V005\\prova'

elev_ranges = 'G:\\Chile_2012\\MODIS10A2.V005\\DEM\\elev_ranges'
list = arcpy.ListRasters ()
out_dir = 'G:\\Chile_2012\\MODIS10A2.V005\\prova\\hypso\\'

arcpy.CheckOutExtension ('Spatial')

for raster in list:
    ZonalHistogram (raster, 'Value', elev_ranges, out_dir+ raster+ '.dbf')
share|improve this question
Ok I found out that this is a problem of the service pack (…). I then tried to save it as an in_memory object without specifying any name as suggested in the link above and it worked, but then how could I make this files permanent? – umbe1987 Sep 14 '12 at 17:51
up vote 0 down vote accepted


The problem was assigning a name to the output table (as specified in the "SP5 announcement" of ESRI). I created "in_memory" files by appending an 'in_memory' string at the end of the pathname, and made a list on the temporary tables created in this way to merge them with the "Merge" tool. Tyhen I deleted all the temporary files by using the "arcpy.Delete_management ('in_memory')" tool and it worked fine. Hope this could help someone in the future. Here is the link with some bugs of ESRI.

share|improve this answer
Anyway, it doesn't work properly, it gives a strange result that has nothing to do with the result coming from a single application of the Zonal tool. Something doesn't work when looping... – umbe1987 Sep 14 '12 at 19:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.