The code below, run as a script added in a toolbox to ArcMap, errors out as shown after a little over a minute. tempBuffer is created, the Case_ field is added, and the case number is added. Actually, only part of the case number was added. the number was ZFY-1234, and only -1234 was added.Why would 1), this would take over a minute, 2) CalculateField not use the whole value and 3) most importantly, why raise this error? buffer_200 hasn't even had anything done to it yet. Editing the geodb with buffer_200 is started, but nothing's been done with that class prior to Append.Thanks for any help.
import arcpy
from arcpy import env
env.workspace = r"\\SDE.GDBServerPath\TestCases_Geodatabase.gdb"
case_number = arcpy.GetParameterAsText(0)
buffer_200 = "Buffer"
#-------------------------------------------------------------------------------
# Buffer Processing
#
def CreateBuffer():
# set buffer parameters
case = "Cases"
output ="tempBuffer"
dist = "200 feet"
side = "OUTSIDE_ONLY"
# create temporary buffer
arcpy.Buffer_analysis(case, output, dist, side)
# add Case_ field and set it's value to the case number
arcpy.AddField_management(output, "Case_", "TEXT")
arcpy.CalculateField_management(output, "Case_", case_number)
# copy tempBuffer to Buffer feature class
arcpy.Append_management(output, buffer_200, "NO_TEST")
# delete tempBuffer
arcpy.DeleteFeatures_management(output)
def main():
CreateBuffer()
arcpy.RefreshTOC
arcpy.RefreshActiveView
pass
if __name__ == '__main__':
main()
Error Message:
Start Time: Thu Mar 22 12:50:21 2012
Running script BufferAndGetOwnerData...
<class 'arcgisscripting.ExecuteError'>: ERROR 999999: Error executing function.
Cannot acquire a lock.
Cannot acquire a lock. [The table Buffer is being written by another process.]
Cannot acquire a lock. [The table Buffer is being written by another process.]
Failed to execute (Append).
Failed to execute (BufferAndGetOwnerData).
Failed at Thu Mar 22 12:51:31 2012 (Elapsed Time: 1 minutes 10 seconds)