arcgis-python-api icon indicating copy to clipboard operation
arcgis-python-api copied to clipboard

arcgis.gis.ContentManager clone_items remap_data error IndexError: list index out of range

Open chrisdel101 opened this issue 9 months ago • 0 comments
trafficstars

Describe the bug When calling remap_data I get an error.

Both the src and target IDs that are failing exist in the target portal. Example w failed IDs: webmap[0].remap_data({'55e1aa9e034a41c5a7f05c6077ce14e5':'e6d17cef0f21497da6adccac3736bbec'})

To Reproduce Since it only does it for some ids it's not straightforward to reproduce. It works for some of the ids, but not for others. I have 5 entries in a dict. It remaps two then fails on the third, even though their is no visible difference between them.

error:

Traceback (most recent call last):
  File "C:\Users\Me\code\source\repos\arcgis-cloner\src\cloners\content_mananger_cloner.py", line 185, in run_content_cloner_webmap_remmapper
    webmap = [item for item in cloned_items if item.type == 'Web Map']  # this is my code here buy rest is source code - this line is not the problem
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Me\code\source\repos\arcgis-cloner\venv\Lib\site-packages\arcgis\gis\__init__.py", line 17989, in remap_data
    expanded_dict[layer.url] = new_item.layers[i].url
                               ~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\Users\Me\code\source\repos\arcgis-cloner\venv\Lib\site-packages\arcgis\gis\__init__.py", line 17989, in remap_data
    expanded_dict[layer.url] = new_item.layers[i].url
                               ~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Platform (please complete the following information):

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

chrisdel101 avatar Jan 23 '25 22:01 chrisdel101