ArcGIS Python API Create View - KeyError: 'itemId'

722
2
10-20-2023 11:25 AM
NickSchroeder
New Contributor II

I am attempting to create a view layer of a Feature Layer through the ArcGIS API for Python. The feature layer collection I have created seems to have all layers and a working item id. However, when attempting to create a view layer of this feature layer, it gives me this error:

Screenshot 2023-10-20 131849.png

The method being used is here:

Screenshot 2023-10-20 131953.png

It is also worth mentioning this exact code was working about 2 hours prior, then stopped working seemingly randomly.

If anyone has any ideas or needs anymore information feel free to let me know.

0 Kudos
2 Replies
SFM_TravisBott
Occasional Contributor III

@NickSchroeder I had the exact same problem with the exact same operation throwing errors in the exact same place of the exact same helper script. The slight differenced: mine was in a loop that ingested a list of jurisdictions and then creates a view for that jurisdiction. Mine worked fine in testing, and then one day it started failing but always the third time through the loop. It would create the first two just fine, run the rest of the script, and would fail at the top of iteration three. 

I did not find a solution; the only thing I did was change up my test list of jurisdictions in the csv that gets ingested and then suddenly it ran through them. 

I'll look forward to this thread staying perfectly quiet and neither of us ever getting an explanation. 

0 Kudos
NickSchroeder
New Contributor II

After further investigation, when I changed the name of the view layer created, it started working again. This leads me to believe there is some sort of hidden view layer somewhere in my content on ArcGIS Online named "Features with Attachments". 

 

This might have started occurring because I messed around with the "overwrite" parameter for the create_view() method. However, I am not certain.

0 Kudos