Select to view content in your preferred language

python: add coded value - schema lock error

2438
2
09-01-2010 01:45 PM
danbecker
Frequent Contributor
Hi all,

So, today while trying to add coded value to domain to a File GDB (arcobjects 9.3) I kept getting "ERROR 000464: Cannot get exclusive schema lock".

After some research, many reported this same problem w/ 9.3 and File GDB, so I decided to take the 'plunge' and install ArcGIS 10 that had been on my desk for a month now.

Long story short, looks like the schema lock 'bugs' with File GDB's didn't get corrected in ArcGIS 10...

All instances of ArcCat/ArcMap are closed. I can add feat. class to this same feat. dataset without any probs; or schema lock errors, but when trying to add coded value to EXISTING domain; schema lock errors occur.

Here is the script:
# Import system modules
import arcpy



arcpy.env.workspace = r"G:\\63D RRC GIS Data\\63D_RSC_GDB"

pathwrksp = arcpy.env.workspace
#print pathwrksp

path2wrksps = arcpy.ListWorkspaces("AR001*")

for path2wrksp in path2wrksps:
    #print "... " + path2wrksp
    arcpy.env.workspace = path2wrksp
    wrksps3 = arcpy.ListWorkspaces("*","FileGDB")
    for wrksp3 in wrksps3:
        arcpy.env.workspace = wrksp3
        print "...... " + arcpy.workspace
        listDomains = arcpy.Describe(wrksp3).Domains        
        for domain in listDomains:
            try:
                arcpy.env.workspace = domain
                #print domain
                if domain == "d_boolen":
                    arcpy.AddCodedValueToDomain_management(wrksp3,"d_boolen", "N", "No.")
                    arcpy.AddCodedValueToDomain_management(wrksp3,"d_boolen", "Y", "Yes.")
                    print "d_boolen fixed"
            except:
                print arcpy.GetMessages()


Here is the error:
Executing: AddCodedValueToDomain "G:\\63D RRC GIS Data\\63D_RSC_GDB\AR001_Arkadelphia\AR001_Arkadelphia.gdb" d_boolen N No.
Start Time: Wed Sep 01 14:40:10 2010
ERROR 000464: Cannot get exclusive schema lock.  Either being edited or in use by another application.
The table was not found.
The index passed was not within the valid range.
Failed to execute (AddCodedValueToDomain).
Failed at Wed Sep 01 14:40:11 2010 (Elapsed Time: 1.00 seconds)
0 Kudos
2 Replies
danbecker
Frequent Contributor
Another interesting find:

When trying to modify the SAME domain from arcToolbox; "add coded value to domain", The same schema lock error is displayed......However, upon viewing the File GDB properties/domains, the coded value, WAS INFACT added to the domain, even through the schema lock error was displayed.

This was the exact same behavior in ArcGIS 9.3; ArcObjects 9.3

any thoughts/comments/suggestions?? I'm puzzled!
0 Kudos
RussellBrennan
Esri Contributor
Hi Dan,

Please contact Esri support so that we can determine what is causing this and get a bug logged if needed.
0 Kudos