I'm trying to clone a dashboard. I've cloned other dashboards before without this happening.
It's very basic dashboard with one map and a gauge and date picker. It's just for testing. It's published and has an id and works via portal.
from arcgis.gis import GIS
id = "71cf8cc7573f400b845ce79a772d7b2a" #actual id of dashboard
src=GIS(url=url,
username=username,
password=password,
verify_cert=True)
trg = GIS(url=url,
username=username2,
password=password2,
verify_cert=True)
db = src.content.get(id)
trg.content.clone_items(items=[db])
This immediately fails. Was something mandatory left out in the construction process?
Traceback (most recent call last):
File "C:\Users\me\code\source\repos\arcgis-cloner\src\portal_app.py", line 211, in run_item_clone
cloned_item = env.content.clone_items(
^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 8738, in clone_items
deep_cloner = clone._DeepCloner(
^^^^^^^^^^^^^^^^^^
File "c:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\_impl\common\_clone.py", line 130, in __init__
dash_list = self._clone_dashboard(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\_impl\common\_clone.py", line 157, in _clone_dashboard
if dataset["dataSource"]["itemId"] not in item_list:
~~~~~~~^^^^^^^^^^^^^^
KeyError: 'dataSource'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 8738, in clone_items
deep_cloner = clone._DeepCloner(
^^^^^^^^^^^^^^^^^^
File "c:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\_impl\common\_clone.py", line 125, in __init__
item["type"] == "Dashboard"
~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'
Edit: fixed typo in code. block 1 demo had missing example lines