repeated AddField operations fails in 10.1, works in 10.0

4872
20
Jump to solution
09-10-2012 06:00 PM
TomTyndall
New Contributor III
The following code is throwing exceptions. The exception occurs at different places in the code; where it breaks on one run it may have successfully gotten past on a previous run.

Here's the error I'm receiving:
ExecuteError: ERROR 000464: Cannot get exclusive schema lock.  Either being edited or in use by another application.
Failed to execute (AddField).

This code runs without issue under 10.0.

import arcpy import os, sys from xml.etree import cElementTree as ElementTree  def addCoreFields(fc):     arcpy.AddField_management(fc, "AssetObjectId", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "AssetId", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "AssetObjectStatus", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "Status", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "Feature", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "SubFeature", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "AssetCode", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "LaneLocation", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "Route", "TEXT", "", "", "32", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "FromMilepost", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "FromOffset", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "ToMilepost", "LONG", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")     arcpy.AddField_management(fc, "ToOffset", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")         if __name__ == '__main__':     scriptPath = sys.path[0]     dataGDB = os.path.join(scriptPath, "data.gdb")     if arcpy.Exists(dataGDB): arcpy.Delete_management(dataGDB)     arcpy.CreateFileGDB_management(scriptPath, "data")      sr = "PROJCS['NAD_1983_StatePlane_Arizona_Central_FIPS_0202_Feet_Intl',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',700000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-111.9166666666667],PARAMETER['Scale_Factor',0.9999],PARAMETER['Latitude_Of_Origin',31.0],UNIT['Foot',0.3048]];-17746700 -44067300 3048;-100000 10000;-100000 10000;3.28083989501312E-03;0.001;0.001;IsHighPrecision"     for name in ['one', 'two', 'three']:           fc = os.path.join(dataGDB, name)         arcpy.CreateFeatureclass_management(dataGDB, name, "POINT", "", "DISABLED", "DISABLED", sr, "", "0", "0", "0")         addCoreFields(fc)
Tags (2)
0 Kudos
20 Replies
NathanHeick
Occasional Contributor II
I ran our ETL again on our new ArcGIS 10.1 Test Server.  The problem appeared immediately 10 minutes into the ETL.  I disabled Behavior Monitoring in Microsoft Forefront and the problem went away when I reran the tool.
0 Kudos