So let's look at what you are doingfcs = gp.ListFeatureClasses()
fc = fcs.next()
while fc:
print fc
fc = fcs.next()
fcs.reset()
fc = fcs.next()
With this code block (above) you are simply printing out the names of the fcs found and not processing anything, fcs.reset() does nothing as it is not implemented so don't use it. so the code below isn't going to do much work as fc will not hold a value.
print gp.GetMessages()
while fc:
print fc
infc= fc
OutRaster = outshp + "/" + str(fc)
print gp.GetMessages()
gp.ExtractByMask_sa(Inraster, infc, OutRaster)
print gp.GetMessages()
If this did work infc would only be the last fc recorded so the mask will only be on that one and not all of them,Why are you using gp and arcpy, just use arcpy.try you code for just 1 fc first and build on that.import arcpy
arcpy.CheckOutExtension("Spatial")
fcs = gp.ListFeatureClasses()
Inraster = "D:/DdAaTtAa/Data/image/"
for fc in fcs:
print fc
infc= fc
OutRaster = outshp + "/" + str(fc)
gp.ExtractByMask_sa(Inraster, infc)
outExtractByMask.save(OutRaster)
which will give you a mask with the last fcOnce you have this working to work on all fc in the list you will need to combine (union/merge...) them into 1 and then apply the mask with this new fc.Hope this helps to get you started if you haven't figured it out already.