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)
flayer_collection.manager.overwrite(outputCSV)
Error:
Traceback (most recent call last):
File "C:\ItemViews\Query_GII_COVID19_Items_Publish2Portal.py", line 30, in <module>
flayer_collection.manager.overwrite(outputCSV)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\managers.py", 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!
Eric
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?
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'))