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.

I have 2 rasters in my workspace, one in TIFF Format and the other in GRID format: "C:\ExampleFolder"

When I use the python script:

import arcpy
>>> rasl=arcpy.ListRasters("C:\ExampleFolder")
>>> print rasl
None

Python does not recognize my raster files. I'm attempting to use the script in this previous question:

Clip a raster using a shapefile into multiple rasters?

I keep receiving error: ERROR 000732: Input Rasters: Dataset does not exist or is not supported.

Any reason why Python does not recognize my raster?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Try explicitly defining the workspace:

import arcpy

arcpy.env.workspace = r'C:\path\to\your\ws'
rasl = arcpy.ListRasters()

The documentation shows that you cannot include the path of your workspace in the ListRaster function:

The workspace environment must be set first before using several of the List functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.

arcpy.ListRasters ({wild_card}, {raster_type})
share|improve this answer
    
Thank you! This works perfectly. –  JC11 Feb 4 at 17:12

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.