I am having an issue with schema locks while working on feature classes within a file geodatabase in ArcMap. There have been similar posts to mine (Avoiding exclusive schema lock error with ArcPy?). However, I am not working in an ArcSDE environment. I am running a Python script through the command line (Conda thru Windows if pertinent):
>>>python add_field_script.py
which calls arcpy functions WHILE ArcMap is open.
arcpy.DeleteField_management(fp_feature, ['field1', 'field2'])
I get this error (in command line console):
File "field_mappings_config.py", line 42, in <module>
arcpy.Delete_management(fc)
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\arcpy\arcpy\management.py", line 4363, in Delete
raise e
arcgisscripting.ExecuteError: ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application.
Failed to execute (Delete).
My attrocious work-around is basically turn off and turn on again. I CLOSE ArcMap and rerun. Removing the fp_feature in the current map and/or collapsing feature dataset in ArCatalog without shutting off does not remove the Schema Lock.
Any ideas?
python add_field_script.py
. OK, so it sounds like there is nothing programmatic I can add to my script to check and unlock gdb or feature classes? Thanks.arcpy.DeleteField_management()
command in isolation. I have not tried running an entire script.