I know that this question has been answered several times before, but for some reason I can't get this script to run... So I was hoping someone could point out where I'm going wrong.
I have two shapefiles, shapefile 1 has polygon boundaries and shapefile 2 has a single polygon that overlaps the firsts polygonal boundaries.
I would like to clip shapefile 2 according to each polygon of shapefile 1.
I have seen several sites and examples, but for some reason I must be overlooking a detail in getting this to work
Some of the examples I've seen are: How to Batch Clip in ArcGIS Desktop 10 using Python/ArcPy?
Batch clip feature class to preserve area field
Clipping buffers to census tracts
import arcpy
arcpy.env.workspace = "path\\to\\workspace\\MaintenanceDivisions"
arcpy.env.overwriteOutput=True
#variables
md = "MaintenanceDivisions.shp"
out = arcpy.CreateUniqueName( "clipped.shp" )
mfp = "dissolved.shp"
try:
#clip polygons from selected area
rows = arcpy.SearchCursor(md)
row = rows.next()
for row in rows:
feat = row.Shape
arcpy.Clip_analysis([mfpd], feat, out, "")
row = rows.next()
except arcpy.ExecuteError as e:
print(e)
del rows