Greetings all,
I followed the workflow as shown on the follow page (https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/) and am receive a key error when attempting to publish my shapefile into a feature layer. My code used to work fine and started throwing an error after no changes were made. My code and error are found below
#Add the shapefile as an item (which publishes perfectly fine)
item_prop = {'title': '2021 NPU Applications', 'tags': 'GIS', 'type':'Shapefile'}
shapefile_item = gis.content.add(item_properties=item_prop, data=my_shapefile)
shapefile_item
#Publish the shapefile item into a feature layer (which throws an error)
Applications_item = shapefile_item.publish()
Applications_item
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-24-2d2a4fbd26be> in <module>
1 #Publish the shapefile item into a feature layer
----> 2 Applications_item = shapefile_item.publish()
3 Applications_item
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py in publish(self, publish_parameters, address_fields, output_type, overwrite, file_type, build_initial_cache)
8860 elif not buildInitialCache and output_type is not None and output_type.lower() in ['sceneservice']:
8861 return Item(self._gis, ret[0]['serviceItemId'])
-> 8862 elif not buildInitialCache and ret[0]['type'].lower() == 'image service':
8863 return Item(self._gis, ret[0]['serviceItemId'])
8864 else:
KeyError: 'type'