I have been using arcpy.mp to automate map production but am having trouble with the listColorRamps() method.
I am running Python 3.6.5 and ArcPro 2.2.1.
If I run this code in the python window within an open aprx, I get a long list of available Color Ramp objects:
However, if I run similar code in IDLE, aprx.ListColorRamps() returns an empty list, and the rest of my map automation therefore fails.
Has anyone else experienced this and/or know of a workaround?
something is amiss
pth = r"C:\GIS\A_Tools_scripts\aprx_info\aprx_info.aprx" proj = arcpy.mp.ArcGISProject(pth) cr = proj.listColorRamps()[:2] cr Out: [<MappingColorRampObject at 0x298e44a1fd0>, <MappingColorRampObject at 0x298e44a1d00>]
check your path to begin with and I noticed that you don't have arcpy before mp… could be a namespace issue.
I recommend not shortcutting shortcuts in code. And you can get its name and that is about all
cr0 = cr cr0.name Out: 'Accent (3 Classes)'
Then if it doesn't work with a direct reference to the *.aprx nor with "CURRENT", that leaves something else... maybe even your installation.
Try a different project for a starter.
If you can try with a different user on your computer, I would as well.
If you have cohorts where you are, try on their machine.
Got to rule out the project, the machine and the user. You hopefully have done the reading from the *.aprx and "CURRENT" to rule that out.
Post back with more info Molly.