Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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:

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000000r000000

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
share|improve this question
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). –  Chad Cooper Feb 11 '13 at 15:11
    
your code work for me as script run from cmd and IDE within ArcMap. –  Emi Feb 11 '13 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 Feb 11 '13 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 Feb 12 '13 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 Aug 9 '13 at 12:58

3 Answers 3

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.

share|improve this answer
    
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 Feb 11 '13 at 15:10
    
Interesting solution! Must be a Windows thing. –  Taylor H. Feb 11 '13 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
share|improve this answer
up vote 1 down vote accepted

Thanks for the suggestions. It still gave the same error even after removing 'r'. I restarted the system and it worked both with and without 'r'.

share|improve this answer

Your Answer

 
discard

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.