Please review the following script. I know that many persons may not now the specifics of the ESRI software. I would simply like someone to review this script and tell me if there is anything wrong with it from either a purely Python or Python + ESRI viewpoint. I would greatly appreciate annotation because I am trying to learn how to create scripts on my own. The script below is my attempt (with great hope) to create a script that will have a folder that contains two types of files (rasters and vectors (aka shapefiles)) it will cycle through these files on a one to one basis. It will take a raster "r_a" and a shapefile "s_a" and then use a readymade function to create a new raster that is the same extent as the shapefile. I will most likely need to get help from the ESRI user forum after I ask here, but I want to make sure that there are no bonehead mistakes yet in this script.
# Extracts the cells of a raster that correspond with the areas
# defined by a mask.
# Import system modules
# Create the Geoprocessor object
gp = arcgisscripting.create()
#Set the input workspace
GP.workspace = "C:/Atest"
#Set the output workspace
outworkspace = "C:/Btest"
#Get a list of the featureclasses in the input folder
rasters = GP.ListRasters()
shapefiles = GP.ListShapefiles()
#Reset the enumeration to make sure the first object is returned
#Loop through the list of feature classes
raster = rasters.Next()
shapefile = shapefiles.Next()
# Set local variables
InRaster = raster
InMask = shapefile
OutRaster = outworkspace + "/" + raster
# Check out Spatial Analyst extension license
# Process: ExtractByMask
gp.ExtractByMask_sa(InRaster, InMask, OutRaster)
# If an error occurred while running a tool, then print the messages.