Issue with FeatureLayerCollection manager

03-26-2020 07:41 AM
Occasional Contributor

Hi all,

Having an issue that's been frustrating me for a few days. Trying to use the FeatureLayerCollection manager to overwrite a hosted table in Portal for ArcGIS 10.6.1 that was created from a CSV. The new CSV I am overwriting with has the same file name, field names, and field types, just new rows obviously.

Below is a snippet of my code along with the error:

from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

portalurl = portalurl
username = adminusername
password = adminpassword

gis = GIS(portalurl,username,password)

search_result= gis.content.get("ITEMID")

outputCSV = r'C:\ItemViews\Test\COVID19_Items.csv'

flayer_collection = FeatureLayerCollection.fromitem(search_result)


Traceback (most recent call last):
File "C:\ItemViews\", line 30, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\", line 1197, in overwrite
lyr_url_info = "%s/layers" % feature_layer_item.layers[0].container._url
IndexError: list index out of range

Any idea why this error would be happening? Any help is truly appreciated since as you can see this is being used to monitor portal metrics related to the Coronavirus.

Thank you!


2 Replies
New Contributor II

I know its been awhile, but I'm working on a similar project, with the same error-  did you ever figure out what was causing it?


0 Kudos
New Contributor

I think you have to place the physical address in memory of your device in this form.

flayer_collection = FeatureLayerCollection.fromitem(feature_Layer)
flayer_collection.manager.overwrite(os.path.join('D:/','Folder', 'CSV.csv'))

0 Kudos