While trying to run the ArcGIS provided python script to interpolate a bunch of rasters on a time-enabled point feature class file I get the following error:

Runtime error Traceback (most recent call last): File "", line 34, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 6043, in MakeFeatureLayer raise e ExecuteError: ERROR 000840: The value is not a Feature Layer.

My code is this (line 34 is talking about making a feature class, and I cannot for the life of me figure out what it's referring to):

    import arcpy, datetime
# Check out the ArcGIS Spatial Analyst extension for using the IDW interpolation tool

arcpy.env.workspace = "C:\Users\Chris\Desktop\interpolation\Interpolation.gdb"

# Get the layer time properties
lyr = arcpy.mapping.Layer(r"C:\Users\Chris\Desktop\interpolation\points.lyr")
lyrTime = lyr.time

# Calculate the number of iterations based on the time extent and timestep interval
startTime = lyrTime.startTime
endTime = lyrTime.endTime
timeExtent = endTime - startTime
timeStepInterval = lyrTime.timeStepInterval

iterations = timeExtent.days / timeStepInterval.interval

# Get the time field containing the time values associated
# with the data in the time-enabled layer
startTimeField = str(lyrTime.startTimeField)

# Specify the output mosaic dataset to which the interpolated rasters will be added 
outputMosaicDataset = r"C:\Users\Chris\Desktop\interpolation\Interpolation.gdb\rasta"

i = 0
while i <= iterations:
    # Formulate the time query and increment the time by the timeStepInterval
    currentTime = str(startTime + (i*timeStepInterval))
    timeQuery = "\"" + startTimeField + "\"" + " = date '" + currentTime + "'"

    # Create an in-memory feature layer containing points that are valid at each timestep
    tempFeatureLyr = "tempTimeLayer" + str(i)
    arcpy.MakeFeatureLayer_management(lyr, tempFeatureLyr, timeQuery)

    # Create an interpolated raster surface using the points valid at each timestep
    outRaster = r"C:\Users\Chris\Desktop\interpolation\Interpolation.gdb\output" + str(i)
    print outRaster
    arcpy.gp.Idw_sa(tempFeatureLyr, "avg_hrly", outRaster)

    # Add the newly created raster surface to a Mosaic Dataset
    arcpy.AddRastersToMosaicDataset_management(outputMosaicDataset, "Raster Dataset", outRaster)

    i = i + 1

# Calculate the statistics on the output Mosaic Dataset for
# classifying your data after new rasters are added   

The error (near top of this post) points to line 34, which reads:

arcpy.MakeFeatureLayer_management(lyr, tempFeatureLyr, timeQuery)

I have checked lyr.isFeatureLayer and it's True, timeQuery returns the next time slice in a proper string format that i have verified in the SQL builder, and tempFeatureLyr = 'tempTimeLayer1'...but it does not create it. As in, I do not see tempTimeLayer1 layer in the Table of Contents, though tempTimeLayer0 IS. So, it's not being created, though its name (tempTimeLayer1) is ready to go...

Here is the site I got the help from, example 3: LayerTime(arcpy.mapping)

  • Your code does not show your lyr variable being set anywhere.
    – PolyGeo
    Commented Feb 14, 2015 at 4:30
  • I'm confused - there's no error showing in the "python window comments while the tool is running" that you posted. I would try running your code from IDLE and then posting the exact error it throws against the exact code you post.
    – PolyGeo
    Commented Feb 14, 2015 at 6:38
  • i have, it's at the very top. The rest was posted not knowing if it would help others or not; evidently, I'll just remove it. Commented Feb 14, 2015 at 7:38

1 Answer 1


The error you are showing is coming from c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py and it would be easier to take a stab at its cause if we knew the precise line from your script - running it in IDLE is how I usually find that.

It may be that it is simply due to you having:

arcpy.env.workspace = "C:\Users\Chris\Desktop\interpolation\Interpolation.gdb"

instead of:

arcpy.env.workspace = r"C:\Users\Chris\Desktop\interpolation\Interpolation.gdb"
  • thanks for the thought, i'll put the r in and let you know. In reference to taking a stab at the arcpy\management.py error, I actually opened up the file and had intentions of going to line 6043 to get more info, but the code is obfuscated, or something, and I couldn't see more than the first 30 lines or so. Standby and I will adjust with the r. What does the r and u do before paths anyway? Commented Feb 14, 2015 at 21:11
  • I would advise strongly against editing anything in c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy because it could invalidate your install. r stands for raw and says to just read the rest of the string "as-is" without interpreting the backslashes as escape characters. u is to do with Unicode characters.
    – PolyGeo
    Commented Feb 14, 2015 at 21:55
  • noted, thanks. I was more or less wanting to poke around the see where it tripped. I appreciate the explanation on r/u, cheers. Commented Feb 14, 2015 at 22:16
  • The errors from IDLE usually point me straight at where the problem lies.
    – PolyGeo
    Commented Feb 14, 2015 at 22:26
  • So in going to IDLE to see what line or info might help it actually ran! Thanks for the nudge Commented Mar 19, 2015 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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