Am trying to clip multiple rasters but getting a runtime error, what could be the problem with my code

import arcpy, os

arcpy.env.workspace = r"E:\Geos4s\GeoS4S Module Geospatial Support for Arid Ecosystem Management\prec_30s_esri\converted"
arcpy.env.overwriteOutput = True

# Clip region
poly = r"E:\Kenya GIS Resources\Kenya New Districts1\Kenya_CountyID.shp"
out_folder =  r"E:\Geos4s\GeoS4S Module Geospatial Support for Arid Ecosystem Management\prec_30s_esri\clipped"
rasters = arcpy.ListRasters()
for raster in rasters:
    out_raster =(out_folder,raster)
    print 'Clipped: %s' %raster
print arcpy.GetMessages()
  • What is the precise error message, including line number, that you receive when you run the code that you have presented?
    – PolyGeo
    Mar 28, 2019 at 12:08

1 Answer 1


You just need to replace:

out_raster =(out_folder,raster)


out_raster = os.path.join(out_folder,raster)

Or out_raster will be a tuple: ('C:\\folder', 'raster.tif'), instead of a path: 'C:\\folder\\raster.tif'

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.