Select to view content in your preferred language

Updating hosted Feature Layer utilizing Python

07-19-2023 09:27 AM
Labels (2)
New Contributor III

I've got a Python program that has been running continuously for the past 16-18 months that updates a Hosted Feature Layer within our AGOL account.

The final "write" portion of the code is

data_hold_csv = 'C:\\USGS Live\\HCT - CU\\Clients\\D4_5_Current_Rsvr_Data.csv'#Working file for filter loop
dst = data_omid
#dst1 = D4_D5_Crrnt_working
copyfile(src, dst)
#copyfile(src, dst1)
gis = GIS("", "user", "password")
print("We're in ...")
search_results ='title: D4-5_Current_Rsvr_Data', 'Feature Layer')
print("Found what we need ... ")
usgs_fs_item = search_results[0]
print("Past the item ... ")
USGS_flayer_collection = FeatureLayerCollection.fromitem(usgs_fs_item)
print("Getting ready to overwrite ... ")
print("1.5 - Feature Layer D4-5_Current_Rsvr_Data has been updated for ",client)

As of 7/14, I began getting the following error:

Selected site raw data has been extracted for rwpc
We're in ...
Found what we need ...
Past the item ...
Getting ready to overwrite ...
Traceback (most recent call last):
File "C:\USGS Live\HCT - CU\", line 497, in <module>
File "C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\features\", line 1169, in overwrite
published_item = related_data_item.publish(publish_parameters, overwrite=True)
File "C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\gis\", line 6852, in publish
serviceitem_id = self._check_publish_status(ret, folder)
File "C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arcgis\gis\", line 7089, in _check_publish_status
raise Exception("Job failed.")
Exception: Job failed.

What has changed, and how do I work around it?  Thanks!

Tags (2)
0 Kudos
1 Reply
Esri Contributor

If the script has not changed then it could be the data that is causing issue. I would check that the schema to your CSV input is still the same and that the Hosted Feature Layer still exists and can be viewed/edited.


Hope that helps!


Esri UK -Technical Support Analyst
0 Kudos