<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic KeyError while overwriting feature layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-while-overwriting-feature-layer/m-p/719585#M122</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I receive an updated csv file on a weekly basis. I am trying to upload/overwrite the existing csv file in AGOL and then use that to update/overwrite the corresponding feature layer. However, I am receiving a KeyError on the serviceItemId when I attempt to overwrite the feature layer. At a loss at this point so any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;hiea_csv_item = gis.content.get(hiea_csv_id) # csv item id&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;hiea_item = gis.content.get(hiea_lyr_id) #&amp;nbsp;&lt;SPAN&gt;feature layer id&lt;/SPAN&gt;&lt;BR /&gt;#update csv&amp;nbsp;using local file&lt;BR /&gt;hiea_csv_item.update({}, hiea_csv_file)&lt;BR /&gt;# call the overwrite() method to update feature layer &amp;amp; service&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;BR /&gt;hiea_feature_collection = FeatureLayerCollection.fromitem(hiea_item)&lt;BR /&gt;# 'HIEA/hiea_sample.csv' is the updated csv file in AGOL&lt;BR /&gt;hiea_feature_collection.manager.overwrite('HIEA/hiea_sample.csv') - fails&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;---------------------------------------------------------------------------&lt;BR /&gt;KeyError Traceback (most recent call last)&lt;BR /&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt; 7059 try:&lt;BR /&gt;-&amp;gt; 7060 serviceitem_id = ret[0]['serviceItemId']&lt;BR /&gt; 7061 except KeyError as ke:&lt;/P&gt;&lt;P&gt;KeyError: 'serviceItemId'&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;KeyError Traceback (most recent call last)&lt;BR /&gt;&amp;lt;ipython-input-11-5acc4e5f313c&amp;gt; in &amp;lt;module&amp;gt;()&lt;BR /&gt; 1 #hiea_feature_collection.manager.overwrite('HIEA/hiea_sample.csv')&lt;BR /&gt;----&amp;gt; 2 hiea_feature_collection.manager.overwrite(hiea_csv_file)&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\features\managers.py in overwrite(self, data_file)&lt;BR /&gt; 1167 #region Perform overwriting&lt;BR /&gt; 1168 if related_data_item.update(item_properties=params, data=data_file):&lt;BR /&gt;-&amp;gt; 1169 published_item = related_data_item.publish(publish_parameters, overwrite=True)&lt;BR /&gt; 1170 if published_item is not None:&lt;BR /&gt; 1171 return {'success': True}&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache)&lt;BR /&gt; 6850 return Item(self._gis, ret[0]['serviceItemId'])&lt;BR /&gt; 6851 else:&lt;BR /&gt;-&amp;gt; 6852 serviceitem_id = self._check_publish_status(ret, folder)&lt;BR /&gt; 6853 return Item(self._gis, serviceitem_id)&lt;BR /&gt; 6854&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt; 7060 serviceitem_id = ret[0]['serviceItemId']&lt;BR /&gt; 7061 except KeyError as ke:&lt;BR /&gt;-&amp;gt; 7062 raise RuntimeError(ret[0]['error']['message'])&lt;BR /&gt; 7063 &lt;BR /&gt; 7064 if 'jobId' in ret[0]:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;KeyError: 'error'&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jan 2019 16:04:58 GMT</pubDate>
    <dc:creator>NCOneMap</dc:creator>
    <dc:date>2019-01-17T16:04:58Z</dc:date>
    <item>
      <title>KeyError while overwriting feature layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-while-overwriting-feature-layer/m-p/719585#M122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I receive an updated csv file on a weekly basis. I am trying to upload/overwrite the existing csv file in AGOL and then use that to update/overwrite the corresponding feature layer. However, I am receiving a KeyError on the serviceItemId when I attempt to overwrite the feature layer. At a loss at this point so any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;hiea_csv_item = gis.content.get(hiea_csv_id) # csv item id&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;hiea_item = gis.content.get(hiea_lyr_id) #&amp;nbsp;&lt;SPAN&gt;feature layer id&lt;/SPAN&gt;&lt;BR /&gt;#update csv&amp;nbsp;using local file&lt;BR /&gt;hiea_csv_item.update({}, hiea_csv_file)&lt;BR /&gt;# call the overwrite() method to update feature layer &amp;amp; service&lt;BR /&gt;from arcgis.features import FeatureLayerCollection&lt;BR /&gt;hiea_feature_collection = FeatureLayerCollection.fromitem(hiea_item)&lt;BR /&gt;# 'HIEA/hiea_sample.csv' is the updated csv file in AGOL&lt;BR /&gt;hiea_feature_collection.manager.overwrite('HIEA/hiea_sample.csv') - fails&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;---------------------------------------------------------------------------&lt;BR /&gt;KeyError Traceback (most recent call last)&lt;BR /&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt; 7059 try:&lt;BR /&gt;-&amp;gt; 7060 serviceitem_id = ret[0]['serviceItemId']&lt;BR /&gt; 7061 except KeyError as ke:&lt;/P&gt;&lt;P&gt;KeyError: 'serviceItemId'&lt;/P&gt;&lt;P&gt;During handling of the above exception, another exception occurred:&lt;/P&gt;&lt;P&gt;KeyError Traceback (most recent call last)&lt;BR /&gt;&amp;lt;ipython-input-11-5acc4e5f313c&amp;gt; in &amp;lt;module&amp;gt;()&lt;BR /&gt; 1 #hiea_feature_collection.manager.overwrite('HIEA/hiea_sample.csv')&lt;BR /&gt;----&amp;gt; 2 hiea_feature_collection.manager.overwrite(hiea_csv_file)&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\features\managers.py in overwrite(self, data_file)&lt;BR /&gt; 1167 #region Perform overwriting&lt;BR /&gt; 1168 if related_data_item.update(item_properties=params, data=data_file):&lt;BR /&gt;-&amp;gt; 1169 published_item = related_data_item.publish(publish_parameters, overwrite=True)&lt;BR /&gt; 1170 if published_item is not None:&lt;BR /&gt; 1171 return {'success': True}&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache)&lt;BR /&gt; 6850 return Item(self._gis, ret[0]['serviceItemId'])&lt;BR /&gt; 6851 else:&lt;BR /&gt;-&amp;gt; 6852 serviceitem_id = self._check_publish_status(ret, folder)&lt;BR /&gt; 6853 return Item(self._gis, serviceitem_id)&lt;BR /&gt; 6854&lt;/P&gt;&lt;P&gt;~\AppData\Local\Continuum\miniconda3\lib\site-packages\arcgis\gis\__init__.py in _check_publish_status(self, ret, folder)&lt;BR /&gt; 7060 serviceitem_id = ret[0]['serviceItemId']&lt;BR /&gt; 7061 except KeyError as ke:&lt;BR /&gt;-&amp;gt; 7062 raise RuntimeError(ret[0]['error']['message'])&lt;BR /&gt; 7063 &lt;BR /&gt; 7064 if 'jobId' in ret[0]:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;KeyError: 'error'&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2019 16:04:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/keyerror-while-overwriting-feature-layer/m-p/719585#M122</guid>
      <dc:creator>NCOneMap</dc:creator>
      <dc:date>2019-01-17T16:04:58Z</dc:date>
    </item>
  </channel>
</rss>

