Gather details of Annotation Subclass from ArcPro map.ListLayers() objects

109
0
07-02-2020 08:19 AM
DavidMetzler1
New Contributor II

I am attempting to remove all Annotation Subclass layers from a list that is generated from a Map inside of ArcPro.
From what I can tell the subclasses must be a "Layer" inside of Pro.

I cannot find a method to conclusively distinguish which layers are annotation subclasses.

l = [list of Layer Objects]
for x in l:
if x:
try:
desc = arcpy.Describe(x)
print (desc.featureClass.featuretype)
except:
print (f"{x} cannot be described")

This will yield "Annotation" for both the Annotation layer, and its subclasses.

desc.name


This will yield the Name of the Annotation layer for all subclasses

for x in l:
print x

generates an error **NameError: The attribute 'longName' is not supported on this instance of Layer** as soon as it hits the Annotation subclass

0 Kudos
0 Replies