Hello,
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:
<SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">edit </SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">=</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> arcpy</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">da</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">Editor</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">(</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">workspace</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">)</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">edit</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">startEditing</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">(</SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;">False</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">,</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> </SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;">True</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">)</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">edit</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">startOperation</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">()</SPAN>
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!