AnsweredAssumed Answered

Editing Session in ModelBuilder or Python?

Question asked by COBJReilly on Sep 19, 2018
Latest reply on Sep 19, 2018 by Dan_Patterson



I'm trying to update a warranty field in my water meter feature class. It is supposed to add 20 years to the installation date. I used ModelBuilder to get the following code:


# Import arcpy module
import arcpy

# Local variables:
WMeter = "WMeter"
WMeter__2_ = WMeter


# Process: Calculate Field
arcpy.CalculateField_management(WMeter, "WarrantyDate", "DateAdd (\"yyyy\",20,[InstallDate] )", "VB", "")


However, I have to manually enter an edit session for this script to run correctly. If I'm not in an editing session it won't update the field the "WarrantyDate" field. Is there a way with Python or ModelBuilder to make it enter into an editing session? I've attempted:

edit = arcpy.da.Editor(workspace)edit.startEditing(False, True)edit.startOperation()

but I always get:

ERROR 001049: ASync operations not allowed while editing.


I have tried swapping out the true/false statements to see if it would change anything but it doesn't seem to matter if each is true or false, I get ASync either way.


Any help is greatly appreciated!