When using the gis.content.clone_items command in the API we consistently see the error below when running it on a webmap in ArcGIS Online containing a hosted view layer. with parameters set to:
"(copy_data=True, search_existing_items=False)"
Traceback (most recent call last):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\_impl\common\_clone.py", line 3404, in clone
and "viewLayerDefinition" in layer["adminLayerInfo"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
The same command works perfectly on version 2.3.0 of the API, the clone completes and it clones both the webmap and hosted view layer correctly, so this seems like a new bug introduced in the API
Solved! Go to Solution.
For anyone that lands here. ESRI have acknowledged this as a bug:
BUG-000177674
The workaround seems to be to fire the clone command from an AGOL notebook, which doesn't generate the error. Which is a little bit cumbersome in my use case as I have had to rewrite a Pro tool box and move half the code to an AGOL note book, but it does work.
For anyone that lands here. ESRI have acknowledged this as a bug:
BUG-000177674
The workaround seems to be to fire the clone command from an AGOL notebook, which doesn't generate the error. Which is a little bit cumbersome in my use case as I have had to rewrite a Pro tool box and move half the code to an AGOL note book, but it does work.