WebMap object getting TraitError from webmapitem

11-08-2021 11:34 PM
Occasional Contributor III

Hi all,

I'm using the example from the ArcGIS Python API doco on how to search for portal items, filter by Web Map. From here I want to get the list of layers within this map but I'm getting an TraitError 

wm_item = gis.content.get('6229f30bb378405397b24615e8dcaf60')

wm = WebMap(wm_item)

TraitError: The 'comm' trait of a Layout instance must be a Comm or None, but a value of class 'ipykernel.comm.comm.Comm' (i.e. <ipykernel.comm.comm.Comm object at 0x000002630B46DE48>) was specified.

Currently using the python within ArcGIS Pro 2.7 with Patch 4 applied.

Has anybody come across this/know what I'm doing wrong?



Tags (3)
0 Kudos
3 Replies
MVP Regular Contributor

Hello Anthony,

Where are you running this script from?

Amanda Bishop, GISP
0 Kudos
New Contributor III

(old question, but I just ran into the same thing and found this, so I'm adding what worked for me so google will crawl it!)

As far as I could tell, this was basically just a problem the jupyter kernel being unhappy in Pro. Quitting and relaunching Pro cured the issue for me.

A little more detail on my situation: I wrote a python script and got it working the way I wanted, then used that as the basis for a Python Toolbox (.pyt). When running the tool created from the script, I was getting the "The 'comm' trait of a Layout instance expected a Comm or None trait" error while creating a WebMap from a web map item already retrieved from the portal. The standalone script continued to work; only the GP tool was failing in this way. Quitting and relaunching Pro cleared it up.

New Contributor III

I found this post via Google, and restarting pro worked for me.  Thanks for the tip!

0 Kudos