In the arcpy window in arcgis, I'm trying to:
iterate through each layer in an mxd
clip the layer to a shapefile (also in the mxd)
export each clipped layer to a geodatabase, with the name of each new clipped feature class being the same as the input layer.
mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, '') import os workSpace = r"J:\foo\bar\test.gdb" for lyr in arcpy.mapping.ListLayers(mxd, '', df): fullPath = os.path.join(workSpace, lyr) arcpy.Clip_analysis(lyr, "clipping_shape", fullPath)
TypeError: object of type 'Layer' has no len()
Edited to add: above error message appears even without the clip_analysis portion of the code, so presumably something is off with the fullPath variable.
I've read this answer but I don't know how to use this portion of the code when populating a geodatabase instead of using shapefiles.