Receive error 160706: Cannot acquire a lock when calculating field

829
0
02-09-2022 06:37 AM
VictoriaTousaw
New Contributor III

I receive the this error when using CalculateField in a notebook run from ArcGIS Pro. My workflow is as follows: select fields based on attributes, then calculate a field of the selected features to be a null value. I have been using the following code to accomplish that: 

arcpy.management.SelectLayerByAttribute("waterbody", "NEW_SELECTION", "WBY_ALIAS1 = ' '", None)
arcpy.management.CalculateField("waterbody", "WBY_ALIAS1", "None", "PYTHON3", '', "TEXT", "NO_ENFORCE_DOMAINS")

 

"waterbody" is a polygon feature class saved to my project gdb and loaded into the active map. 

This same code is run 2 other times in my notebook for different feature classes (one is a point, one is a line), all stored in the same location and loaded into the active map. When I run this cell on its own, I receive no errors. When I run all the cells in the notebook, I will receive the error on one of the three runs of CalculateField. Every time I run the code in the notebook a different calculate field line will receive the error message, and if I run the cells from that point on without editing anything, I don't receive an error.  

Not sure what the root cause of this issue is as it seems to be somewhat random and there is limited information when looking up the error code. 

0 Replies