I am trying to Iterate through my TOC and "Erase" part of the feature layers by using a predefined mask. However I keep getting an error that tells me the "Mask" is either not supported, or does not exist. I can say that the feature exists and that the format is supported, as it does work when I use "Erase" within ArcMap itself. Hence it must be something in my code.
I am a beginner at best when it comes to Arcpy/Python.
I have checked the path and this is correct.
Code:
import arcpy
import arcpy.mapping
Project_number = arcpy.GetParameterAsText(0)
Export = r"G:\\zn\\NM\\GGB\\Applicaties-Admin\\Kerngis\\ExpImp\\{}\\Export_{}\\Mask".format(Project_number, Project_number)
Import = r"G:\zn\NM\GGB\Applicaties-Admin\Kerngis\ExpImp\{}\Import_{}\Erased".format(Project_number, Project_number)
mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD
for df in arcpy.mapping.ListDataFrames(mxd, ''): # Loop through dataframes
for lyr in arcpy.mapping.ListLayers(mxd, '', df): # Loop through layers
arcpy.Erase_analysis (lyr, Export, Import)
r
before the path because you already escaped the backslash using `\\`. – ahmadhanb Jan 30 '19 at 13:22