wgivens

upgrading python code

Discussion created by wgivens on Aug 8, 2011
Latest reply on Aug 9, 2011 by wgivens
Been trying to upgrade a python script of mine to use the new Arc 10 syntax  what I have is a For loop that I'm trying to recode, and I'm having issues trying to get the name of the raster in each iteration.  Anybody got a direction to point me in?

import arcpy


# inDIR = arcpy.getparameterastext(0)
# outDIR = arcpy.getparameterastext(1)
# clipFC = arcpy.getparameterastext(2)

arcpy.env.workspace = "C:/Temp/imagery/"
outDIR = "C:/Temp/imagery/clipped/"
clipFC = "C:/Temp/clip_shapefile.shp"
 
# raster = rasters.Next()
rasters = arcpy.ListRasters()

for raster in rasters:
 
 # count = 0
 name = rasList.next()
 # while name != None:
 outname = name.split(".")[0] + "_clip.tif"
 arcpy.compression= "LZW"
 arcpy.Clip_management(name, "#", os.path.join(outDIR, outname), clipFC, "#", "ClippingGeometry")
 # count = count + 1
 # name = rasList.next()


Thanks,
Wade

Outcomes