Open afhughes opened 1 year ago
I'm seeing the error below when trying to clone a Form item, the other item types seem to clone without issue
cloned_form= target.content.clone_items(items=form])
`--------------------------------------------------------------------------- ParseError Traceback (most recent call last) /opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in update_form(self, target, new_item, clone_mapping) 5027 payload["form"] = self._replace_form( -> 5028 form, field_mapping 5029 )
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _replace_form(self, xml_string, lookup) 4819 def _replace_form(self, xml_string: str, lookup: dict) -> str: -> 4820 xml = ElementTree.fromstring(xml_string) 4821
/opt/conda/lib/python3.7/xml/etree/ElementTree.py in XML(text, parser) 1314 parser = XMLParser(target=TreeBuilder()) -> 1315 parser.feed(text) 1316 return parser.close()
ParseError: mismatched tag: line 5, column 434
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last) /opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 4894 original_item = self.info -> 4895 self.update_form(self.target, new_item, self._clone_mapping) 4896 _share_item_with_groups(
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in update_form(self, target, new_item, clone_mapping) 5132 "Failed to update {0} {1}: {2}".format( -> 5133 new_item["type"], new_item["title"], str(ex) 5134 )
Exception: Failed to update Form Peel Ports Decimal Issue: mismatched tag: line 5, column 434
_ItemCreateException Traceback (most recent call last) /tmp/ipykernel_124/4002343211.py in ----> 1 cloned_flyr = target.content.clone_items(items=[hosted_fl])
/opt/conda/lib/python3.7/site-packages/arcgis/gis/init.py in clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner, preserve_item_id) 6730 preserve_item_id=preserve_item_id, 6731 ) -> 6732 return deep_cloner.clone() 6733 6734 def bulk_update(self, itemids, properties):
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 1156 1157 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: -> 1158 results = executor.submit(self._clone, executor).result() 1159 return results 1160
/opt/conda/lib/python3.7/concurrent/futures/_base.py in result(self, timeout) 433 raise CancelledError() 434 elif self._state == FINISHED: --> 435 return self.__get_result() 436 else: 437 raise TimeoutError()
/opt/conda/lib/python3.7/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
/opt/conda/lib/python3.7/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc)
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _clone(self, excecutor) 1129 if item: 1130 item.delete() -> 1131 raise ex 1132 1133 level += 1
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 4906 original_item["type"], original_item["title"], str(ex) 4907 ), -> 4908 new_item, 4909 ) 4910
_ItemCreateException: ('Failed to create Form Peel Ports Decimal Issue: Failed to update Form Peel Ports Decimal Issue: mismatched tag: line 5, column 434', <Item title:"Peel Ports Decimal Issue" type:Form owner:adhughes@esriuk.com>)
`
I should add that I'm cloning from AGOL to Enterprise (10.9.1)
Hi,
I have the same issue cloning from AGOL to Enterprise (10.8.1).
I'm seeing the error below when trying to clone a Form item, the other item types seem to clone without issue
cloned_form= target.content.clone_items(items=form])
`--------------------------------------------------------------------------- ParseError Traceback (most recent call last) /opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in update_form(self, target, new_item, clone_mapping) 5027 payload["form"] = self._replace_form( -> 5028 form, field_mapping 5029 )
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _replace_form(self, xml_string, lookup) 4819 def _replace_form(self, xml_string: str, lookup: dict) -> str: -> 4820 xml = ElementTree.fromstring(xml_string) 4821
/opt/conda/lib/python3.7/xml/etree/ElementTree.py in XML(text, parser) 1314 parser = XMLParser(target=TreeBuilder()) -> 1315 parser.feed(text) 1316 return parser.close()
ParseError: mismatched tag: line 5, column 434
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last) /opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 4894 original_item = self.info -> 4895 self.update_form(self.target, new_item, self._clone_mapping) 4896 _share_item_with_groups(
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in update_form(self, target, new_item, clone_mapping) 5132 "Failed to update {0} {1}: {2}".format( -> 5133 new_item["type"], new_item["title"], str(ex) 5134 )
Exception: Failed to update Form Peel Ports Decimal Issue: mismatched tag: line 5, column 434
During handling of the above exception, another exception occurred:
_ItemCreateException Traceback (most recent call last) /tmp/ipykernel_124/4002343211.py in
----> 1 cloned_flyr = target.content.clone_items(items=[hosted_fl])
/opt/conda/lib/python3.7/site-packages/arcgis/gis/init.py in clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner, preserve_item_id) 6730 preserve_item_id=preserve_item_id, 6731 ) -> 6732 return deep_cloner.clone() 6733 6734 def bulk_update(self, itemids, properties):
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 1156 1157 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: -> 1158 results = executor.submit(self._clone, executor).result() 1159 return results 1160
/opt/conda/lib/python3.7/concurrent/futures/_base.py in result(self, timeout) 433 raise CancelledError() 434 elif self._state == FINISHED: --> 435 return self.__get_result() 436 else: 437 raise TimeoutError()
/opt/conda/lib/python3.7/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
/opt/conda/lib/python3.7/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc)
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in _clone(self, excecutor) 1129 if item: 1130 item.delete() -> 1131 raise ex 1132 1133 level += 1
/opt/conda/lib/python3.7/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc)
/opt/conda/lib/python3.7/site-packages/arcgis/_impl/common/_clone.py in clone(self) 4906 original_item["type"], original_item["title"], str(ex) 4907 ), -> 4908 new_item, 4909 ) 4910
_ItemCreateException: ('Failed to create Form Peel Ports Decimal Issue: Failed to update Form Peel Ports Decimal Issue: mismatched tag: line 5, column 434', <Item title:"Peel Ports Decimal Issue" type:Form owner:adhughes@esriuk.com>)
`