Dataset exist and I am able to get statistics from ArcGIS python window. But it failed as a script with error: ERROR 000865: Input raster: C:\temp\ras does not exist. I have tried following suggestions:


but to no avail.Please suggest how to handle this

import arcpy

stat = arcpy.GetRasterProperties_management(r'C:\temp\ras', "MEAN")
avg = stat.getOutput(0)
print avg
  • 2
    I just took your exact code, replaced your raster path with one to a file geodatabase raster (using the raw string input method of r"C:\path to raster"), and it worked just fine as a script run from my IDE (not from within ArcMap). Commented Feb 11, 2013 at 15:11
  • your code work for me as script run from cmd and IDE within ArcMap.
    – Emi
    Commented Feb 11, 2013 at 15:27
  • Exactly what is the full name (with path) of your raster? The error message is perfectly clear--it's not "c:\temp\ras"!
    – whuber
    Commented Feb 11, 2013 at 17:13
  • It is "ras" and I stated below that after restarting my system, I got it working (reasons aren't obvious to me...maybe a windows thing).
    – Ibe
    Commented Feb 12, 2013 at 9:25
  • I had the exact same thing happen to me with AsciiToRaster_conversion. I just restarted the computer and it seemed to work just fine.
    – user20910
    Commented Aug 9, 2013 at 12:58

4 Answers 4


Remove the 'r' in your first argument and try forward slashes instead. It will look like this:

stat = arcpy.GetRasterProperties_management('C:/temp/ras', "MEAN")

The function GetRasterProperties_management takes two arguments. The first being the path of the raster and the second is the property. Read more about the function here.

  • Thanks for the suggestion. It still gave the same error even after removing 'r'. I restarted the system and it worked both with and without 'r'.
    – Ibe
    Commented Feb 11, 2013 at 15:10
  • Interesting solution! Must be a Windows thing.
    – Taylor H.
    Commented Feb 11, 2013 at 15:16

is "\ras" the folder where the raster is in or is this the raster already? what format is your raster in? you could try with ListRasters first and use the result

arcpy.env.workspace = r"c:\test"
lr = arcpy.ListRasters()
stat = arcpy.GetRasterProperties_management(lr[0], "MEAN") #use the first raster in the list
avg = stat.getOutput(0)
print avg

It still gave the same error even after removing 'r'.

I restarted the system and it worked both with and without 'r'.


I have had similar issues with raster processing. I have noticed that you will have less issues with processing a large number of datasets if you set environment variables arcpy.env.workspace and arcpy.env.extent.

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.