Hello,
I am trying to use clone_items for ArcGIS API for Python. I am trying to clone a map to another AGOL folder which should copy the map and all dependent items to the specified folder. This works for other maps in my content but it is failing for the specific map I need to copy today. Does anyone know why this would be failing? I get the following error(s).
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 1913, in clone
self._add_features(new_layers, relationships, layer_field_mapping, feature_service.properties['spatialReference'])
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 1281, in _add_features
object_id_mapping[layer_id] = {layer_features['attributes'][object_id_field] : add_results['objectId'] for i in range(0, len(layer_features))}
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 1281, in <dictcomp>
object_id_mapping[layer_id] = {layer_features['attributes'][object_id_field] : add_results['objectId'] for i in range(0, len(layer_features))}
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "r:\GIS_Warehouse\Production\Projects\CVRP\Scripts\promoteAGOL.py", line 107, in <module>
main()
File "r:\GIS_Warehouse\Production\Projects\CVRP\Scripts\promoteAGOL.py", line 92, in main
successItems = ag.content.clone_items(cloneArray, folder=promoteFolder, search_existing_items=False)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\gis\__init__.py", line 4034, in clone_items
return deep_cloner.clone()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 676, in clone
results = executor.submit(self._clone, executor).result()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\concurrent\futures\_base.py", line 432, in result
return self.__get_result()
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\concurrent\futures\_base.py", line 384, in __get_result
raise self._exception
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 663, in _clone
raise ex
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\_impl\common\_clone.py", line 1922, in clone
raise _ItemCreateException("Failed to create {0} {1}: {2}".format(original_item['type'], original_item['title'], str(ex)), new_item)
arcgis._impl.common._clone._ItemCreateException: ('Failed to create Feature Service xxx: list index out of range', <Item title:"xxx" type:Feature Layer Collection owner:xxx>)