Unable to append feature to another feature class

536
2
03-27-2012 09:51 AM
Zeke
by
Regular Contributor III
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).
Tags (2)
0 Kudos
2 Replies
BruceNielsen
Occasional Contributor III
Do you get the same error if your workspace is on a local drive instead of a server?
0 Kudos
Zeke
by
Regular Contributor III
I'll try that, but I'm thinking now that I don't actually need to keep the copy of the buffer. It was done that way previously, but once a series of maps are produced, I don't see a need to keep a copy of it around, especially when it can be reproduced at any time.
I'm trying to automate things for people in another department, but if they can get the maps they want, no need to stick with the way they were doing it. They'll never know, or have a need to know, how it's done.
0 Kudos