recurvata

Unable to append feature to another feature class

Discussion created by recurvata on Mar 27, 2012
Latest reply on Mar 27, 2012 by recurvata
The script below creates a buffer around a parcel in a feature class called 'tempBuffer'. This part works, except for an unrelated problem (creates buffers around all parcels, not just the selected one) I'll post in another thread if I can't figure it out.

The problem is that I can't then append the feature from tempBuffer to the Buffer feature class. The script and error messages are below. Nothing else is doing anything with Buffer, which in my test environment is limited by a definition query to the same case_numberanyway. Any ideas? Thanks.

edit: When run as a tool, and not from PyScripter, no error pops up. But, the Buffer attribute table in ArcMap doesn't show the new buffer, even after refreshing, while ArcCatalog does. Either way, it doesn't show in the map.

Script:

import arcpy
from arcpy import env

env.workspace = r"\\TestServer\TestCases_Geodatabase.gdb"
buffer_200 = "Buffer"

#-------------------------------------------------------------------------------
# Buffer Processing
#
def CreateBuffer():
    # set buffer parameters
    case = "Cases"
    output ="tempBuffer"
    dist = "200 feet"
    side = "OUTSIDE_ONLY"
    case_number = raw_input("Enter Case #")

    # delete existing temporary buffer, if any
    if arcpy.Exists(output):
        arcpy.Delete_management(output)

    # create temporary buffer
    arcpy.Buffer_analysis(case, output, dist, side)

    # copy tempBuffer to Buffer feature class
    try:
        print "Starting Append..."
        arcpy.Append_management(output, buffer_200, "NO_TEST", "First", "")
    except Exception as e:
        print "Unable to copy temporary buffer to Buffer feature class"
        print e.message


Error:

Starting Append...
Unable to copy temporary buffer to Buffer feature class
ERROR 999999: Error executing function.
Cannot acquire a lock.
Cannot acquire a lock. [The table Buffer is being written by another process.]
Failed to execute (Append).

Outcomes