listColorRamps() returns empty list ?

08-29-2018 12:31 PM
New Contributor III


I have been using 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?

Thank you!

Tags (2)
0 Kudos
3 Replies
MVP Legendary Contributor

something is amiss 

pth = r"C:\GIS\A_Tools_scripts\aprx_info\aprx_info.aprx"

proj =

cr = proj.listColorRamps()[:2]

[<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[0]
Out[21]: 'Accent (3 Classes)'
0 Kudos
New Contributor III

Thanks for the help. However, I tried the code as you describe above using the full call and still no luck ... I get an empty list when calling listColorRamps().

0 Kudos
MVP Legendary Contributor

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.