2

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 raster using shapefile into multiple rasters using ArcGIS Desktop?

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?

1 Answer 1

8

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})
0

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.