Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clone_items dashboard KeyError: 'dataSource' #2187

Open
chrisdel101 opened this issue Jan 10, 2025 · 0 comments
Open

clone_items dashboard KeyError: 'dataSource' #2187

chrisdel101 opened this issue Jan 10, 2025 · 0 comments
Assignees
Labels

Comments

@chrisdel101
Copy link

chrisdel101 commented Jan 10, 2025

Describe the bug

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.
Is there something that was missed in the construction that is causing this?

To Reproduce
Steps to reproduce the behavior:

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])

Error:

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'

Platform (please complete the following information):

  • OS: [e.g. iOS] Windows 11
  • Browser [e.g. chrome, safari]
  • Python API Version [e.g. 1.6.2] (you can get this by typing print(arcgis.__version__) arcgis V 2.4.0

EDIT: added lines to make example py more accurate. Was missing lines and was more like pseudocode and could have suggest the error was just due to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants