When you say that clone_items works only with administrator accounts - do you mean only the initial administrator, or any administrator account?
I tried a very basic clone between two administrator accounts (one initial, one not) as shown below, but it won't work. Anything I'm missing? The item in the example is a simple line hosted feature service.
from arcgis.gis import GIS
from IPython.display import display
gis1 = GIS("https://esrica-services.maps.arcgis.com", "testMigration_pw", "XXXXXXX")
gis2 = GIS("https://esrica-pw.maps.arcgis.com", "testMigrationpw", "XXXXXXX")
item = gis1.content.get("05dc246acf9e41b0bef594ba81980da9")
cloned_items = gis2.content.clone_items([item])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)
1452
-> 1453 feature_service = FeatureLayerCollection.fromitem(new_item)
1454 feature_service_admin = feature_service.manager
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in fromitem(cls, item)
8188 def fromitem(cls, item):
-> 8189 if not item.type.lower().endswith('service'):
8190 raise TypeError("item must be a type of service, not " + item.type)
AttributeError: 'NoneType' object has no attribute 'type'
During handling of the above exception, another exception occurred:
_ItemCreateException Traceback (most recent call last)
<ipython-input-14-ab982857fca6> in <module>()
----> 1 cloned_items = gis2.content.clone_items([item])
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, search_existing_items, item_mapping, group_mapping)
3419 wgs84_extent = clone._wgs84_envelope(service_extent)
3420 deep_cloner = clone._DeepCloner(self._gis, items, folder, wgs84_extent, service_extent, use_org_basemap, copy_data, search_existing_items, item_mapping, group_mapping)
-> 3421 return deep_cloner.clone()
3422
3423 def bulk_update(self, itemids, properties):
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)
569 def clone(self):
570 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
--> 571 results = executor.submit(self._clone, executor).result()
572 return results
573
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\concurrent\futures\_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\concurrent\futures\_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\concurrent\futures\thread.py in run(self)
54
55 try:
---> 56 result = self.fn(*self.args, **self.kwargs)
57 except BaseException as exc:
58 self.future.set_exception(exc)
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in _clone(self, excecutor)
560 if item:
561 item.delete()
--> 562 raise ex
563
564 level += 1
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\concurrent\futures\thread.py in run(self)
54
55 try:
---> 56 result = self.fn(*self.args, **self.kwargs)
57 except BaseException as exc:
58 self.future.set_exception(exc)
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self)
1755 return new_item
1756 except Exception as ex:
-> 1757 raise _ItemCreateException("Failed to create {0} {1}: {2}".format(original_item['type'], original_item['title'], str(ex)), new_item)
1758
1759
_ItemCreateException: ("Failed to create Feature Service myLineLayer: 'NoneType' object has no attribute 'type'", None)