Select to view content in your preferred language

Clone_items() No Longer Cloning Dashboards

643
6
08-01-2024 02:35 PM
JoeWaters
Emerging Contributor

I have a simple cloning Notebook to clone items from one account to another. This has worked well for quite some time. Recently I noticed it will clone webmaps, hosted feature layers, and Survey123 forms, but will no longer clone Dashboards.

I am seeing this error:

TypeError: '>=' not supported between instances of 'str' and 'int'

 

After executing the clone_items() function:

 

#... connect to "source" and "target" AGOL accounts in prior steps

# Identify the item to clone
item = source.content.get("AGOL ITEM ID")

# Clone the item to the target account
cloned_items = target.content.clone_items(items=[item])

 

 

Here is a screenshot of the error message:

DashboardCloningError1.PNG

 

Any ideas as to why this is happening and/or potential work arounds?

0 Kudos
6 Replies
EarlMedina
Esri Regular Contributor

Seems like there's a hiccup in the logic there at least for your case. Apparently, data["version"] is a string that needs to be parsed into an integer for that comparison to work.

The first thing you can do is log an issue here with a description of your problem pretty much exactly as you posted: Issues · Esri/arcgis-python-api · GitHub

 

Next, if you are comfortable doing a bit of troubleshooting you can create a test conda environment (so you don't mess up your production environment) and tweak the source to see if it fixes your problem.

 

You can try making this change in the indicated file at line 4563:

if data["version"]:
    if int(data["version"]) >= 24:
        webmap_ids = _DashboardDefinition._get_webmap_ids_v24(data)

 

 

0 Kudos
JeffGarcia
Emerging Contributor

Hello,

I am also unable to clone dashboards using the clone_items() method. I noticed this when running my script through portal notebooks which is using the API version 2.1.0.3, yet when I run the same script using API version 2.1.0.2 on my local machine, my script runs fine. Were there some significant changes in the 2.1.0.3 version that may be causing this? Am I missing any additional parameters? If possible, how could I revert my notebook server to use the 2.1.0.2 version of the API? I have attempted on newly created dashboards, existing ones, and dashboards that have been cloned from other environments and always get the following results: 

JeffGarcia_0-1722974453253.png

 

0 Kudos
EarlMedina
Esri Regular Contributor

You should be able to do something like this in the python command prompt installed with the software (with your environment active):

conda install <pkg>=<version>
0 Kudos
KeitherPerkinsWSB
Emerging Contributor

I am currently having this exact issue using clone_items() in a Notebook in ArcPro 3.1.3. Has this been addressed? @EarlMedina 

0 Kudos
EarlMedina
Esri Regular Contributor

I'm not sure, unfortunately. I may be wrong, but it looks like nothing was logged for this behavior when this thread was last active: https://github.com/Esri/arcgis-python-api/issues

0 Kudos
KeitherPerkinsWSB
Emerging Contributor

I have talked to ESRI support and their are known bugs for cloning all apps with the clone.items() function. I have been told there is no current work around or other functions that could be used on cloning Apps and these bugs will be addressed in the ArcGIS API Python 2.4 release. Which they do not have an official release date for but possibly October 2024.  

To me this makes all the documentation out there on cloning items irrelevant. 
https://developers.arcgis.com/python/guide/cloning-content/
https://developers.arcgis.com/python/guide/cloning-complex-apps/#web-experiences

 

0 Kudos