2

The following code puts an sr.lock on each table in my List. What’s causing my tables to lock up?

I understand my script is reading or opening my tables temporarily to perform the “MakeRouteEventLayer_lr” Geoprocessing but since I’m not necessarily inserting a cursor I should not have to delete references to a table right?

As a result of my tables locking up while running the “MakeRouteEventLayer_lr()”, I am not able to run the second Geoprocessing tool “arcpy.AddXY_management()”.

Currently, in order to accomplish my task I have to run each of the Geoprocessing as a standalone process and even then the tables are locked once they finish processing.

I would greatly appreciate it if someone can help me isolate this problem. By the way my source data is in a file geodatabase. I've ran the code below in pythonWin and ArcMap with the same results.

# First Geoprocessing

Table_List = arcpy.ListTables()
for t_list in Table_List:
    arcpy.MakeRouteEventLayer_lr(PODS_ROUTEM, "ROUTE_CODE", t_list, "Route_Code POINT measure", t_list+'_EVENT', "", "NO_ERROR_FIELD", "NO_ANGLE_FIELD", "NORMAL", "ANGLE", "LEFT", "POINT")
    arcpy.CopyFeatures_management(t_list+'_EVENT',t_list+'_EVENT')

# Second geoprocessing    

fc_list = arcpy.ListFeatureClasses()
for fc in fc_list:     
    arcpy.AddXY_management(fc)
    arcpy.CopyFeatures_management(fc,fc)

1 Answer 1

2

You are trying to copy features back to themselves. See the documentation on CopyFeatures_management for correct usage. Your in features should be different to your output feature class. That is most likely why you are getting a lock.

In the first Geoprocessing, change the output feature class to something else. Do the same to the second Geoprocessing.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.