I am using an update cursor in a script and need to make edits from arcpy.da.Editor. The error that is being thrown is a Runtime Error where the feature class cannot be opened.
import arcpy
import GetSRConfig
import os
def GetThisDir():
import inspect
return os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
sDir = GetThisDir()
sSDECon = os.path.join(sDir, GetSRConfig.SDEConnFile)
sdeLayer = os.path.join(sSDECon, GetSRConfig.LN_SDEDATA)
pWorksapce = (sSDECon)
edit = arcpy.da.Editor(pWorksapce)
edit.startEditing(False, False)
srField = "NUMBERCYLA"
vehNameDi = dict ([(sr, vehNam) for sr, vehName
in arcpy.da.SearchCursor
(GetSRConfig.LN_SDEDATA, [GetSRConfig.FN_NUMBERCYLA, GetSRConfig.FN_VehiclNam],"""VehicleNam <> ''""")])
with arcpy.da.UpdateCursor(GetSRConfig.LN_SDEDATA, [GetSRConfig.FN_NUMBERCYLA,GetSRConfig.FN_VehiclNam],"""VehicleNam = ''""") as cursor:
for sr, vehNam in cursor:
if not sr in vehNameDi:
continue
row = (sr, vehNameDi [sr])
cursor.updateRow (row)
del cursor
edit.stopEditing(True)