I developed an arcpy script that includes overwriting a hosted feature service in Portal with data from a csv file. The script ran just fine in ArcGIS Enterprise version 10.8.1 but I recently upgraded to 10.9.1 and it fails. The script was written using Python 3.7. Below is a copy of my script and attached is a log file. Notice everything works fine up until manager.overwrite. Did something change in 10.9.1 that is causing this to fail?
from arcgis.gis import GIS
from arcgis.features import *
import pandas as pd
import logging
#--------------PARAMETERS--------------
csv = r'\\MyServer\Events.csv' #CSV file that will be overwritten with updates from JSON
jsonEvents = 'https://TheJsonFile' #JSON file location on web
eventID = 'xyz' #ID of feature layer in portal that will be overwritten.
portal = 'https://MyServer.azdes.gov/portal'
portalUID = 'UserName'
portalPWD = 'Password'
#------------Process----------------
#Create log file
logging.basicConfig(filename='logEvents.log', filemode='w', level=logging.INFO)
try:
logging.info("Process Started")
#Read JSON URL and copy to csv file
df = pd.read_json(jsonEvents) #reads JSON file
df.to_csv(csv,index=False,header=True) #Writes json events to csv file
logging.info('CSV Updated')
#Log in to portal
gis = GIS(url = portal, username = portalUID, password = portalPWD)
logging.info('Logged in to Portal')
#Identify the feature layer that will be overwritten and convert to feature layer collection
fsEvents = gis.content.get(eventID)
flcEvents = FeatureLayerCollection.fromitem(fsEvents)
logging.info("Feature Layer Collection created")
#Overwrite the feature layer collection with results from the csv
flcEvents.manager.overwrite(csv)
logging.info("Overwrite Successful. End Process")
except:
logging.exception('Process failed')
raise