Error with Annotate Selected Features in ArcGIS Pro 2.1.2

117
0
09-18-2018 07:29 AM
MaxReis
New Contributor II

I'm trying complete a script that will automatically create an annotation layer from a feature layer in ArcGIS Pro but am hitting a wall with the "Annotate Selected Features" code block (all information is on the ESRI site here).

Here's my code:

import arcpy 
import os 
import os.path 
import sys 
import datetime 
 
arcpy.env.workspace = r"C:\Users\myname\Desktop\USACE\Working_Map\Working_map.gdb"  
aprx = arcpy.mp.ArcGISProject(r"C:\Users\myname\Desktop\USACE\Working_Map\Working_Map.aprx")  
m = aprx.listMaps("Map")[0]  
lyr = m.listLayers("WGRES_Layer")[0]  

arcpy.AnnotateSelectedFeatures_cartography(m, 'WGRES_Layer', "WGRES_LayerAnno 'Class 1'", 'GENERATE_UNPLACED')

Now the weirdest thing is the error message I get when I try to run this block; I get the message:

Traceback (most recent call last):
   File "<string>", line 15, in <module> 
AttributeError: module 'arcpy' has no attribute 'AnnotateSelectedFeatures_cartography'

Does anyone have any idea what's going on? I get the same thing if I tried to run the tool as "AnnotateSelectedFeatures" instead (i.e. remove "_cartography" from the end).

If you have any clue, please feel free to contact me; I'm really banging my head against a wall here!

Tags (1)
0 Kudos
0 Replies