You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Geoprocessing Scripting (Python, JavaScript, VB) forum

One solution for "cannot get exclusive sche...   Scott McGee Feb 15, 2008
Re: One solution for "cannot get exclusive...   Weisen Gao Mar 04, 2008
Re: One solution for "cannot get exclusive...   Eric Rafn Jan 23, 2009
Re: Another possible solution for "cannot g...   Rebecca Strauch Aug 18, 2009
Re: One solution for "cannot get exclusive...   Patrick Tsoi-A-Sue May 11, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject One solution for "cannot get exclusive schema lock" 
Author Scott McGee 
Date Feb 15, 2008 
Message I was recently doing some Python scripting and ran into the problem where the first run of the script worked perfectly, but subsequent runs would give the "cannot get exclusive schema lock" error. One of the processes in the script adds the X and Y fields to a table, and it was at this point in the script that the error would occur.

I found a way to fix this problem, and despite the fact that I thought I needed to look for the solution in ArcGIS, in actuality the solution was independent of Arc. In the Windows File Explorer, I looked at the properties of the folder where my script was putting its data. I saw that the folder was set to READ ONLY. After I turned off the read only attribute for the folder, my script worked perfectly - first time and every time thereafter.

So, if you are having this error, clearing the READ ONLY attribute on your folders might solve your problem. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: One solution for "cannot get exclusive schema lock" 
Author Weisen Gao 
Date Mar 04, 2008 
Message Thank you. It works!

Whenever you meet the error, just create a new folder and then run your script again. This is my way. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: One solution for "cannot get exclusive schema lock" 
Author Eric Rafn 
Date Jan 23, 2009 
Message Thanks Scott and Weisen. It works for me too!

I used Weisen's "create a new folder" technique.

Eric 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Another possible solution for "cannot get exclusive schema lock" 
Author Rebecca Strauch 
Date Aug 18, 2009 
Message Just in case this will solve it for others, I was getting the same error and this thread helped spark my memory. Adding the following line solved the problem for me...

# Assign scratch workspace
scratchWS = gp.scratchWorkspace

For more info, check out webhelp...
http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Techniques%20for%20sharing%20Python%20scripts

-Becky Strauch
ADF&G - DWC
 
  Rebecca Strauch
AK Dept of Fish and Game - DWC
Anchorage, AK 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: One solution for "cannot get exclusive schema lock" 
Author Patrick Tsoi-A-Sue 
Date May 11, 2010 
Message Thanks, this solved my problem.

I was testing code by Chad D. Cooper
ArcUser Spring 2010 Page 37
Listing#6
I kept getting this error.
ERROR 000601: Cannot delete ...
May be locked by another application.

Removed read only check on file/directory properties(When I checked the properties after clearing the read only checkbox it seemed to keep show as read only). I switched to my data drive D:, created my files there and it worked!!!

Executing: Clip NhdMediumResLinesBeaver_Lyr c:\Data\ark_data.gdb\ArkansasCityLimits_1 c:\Data\ark_data.gdb\NhdMediumResLinesBeaver_WithinCityLimits #
Start Time: Tue May 11 16:16:51 2010
ERROR 000601: Cannot delete c:\Data\ark_data.gdb\NhdMediumResLinesBeaver_WithinCityLimits. May be locked by another application.
Failed to execute (Clip).


********** After the fix ***********

Executing: Clip NhdMediumResLinesBeaver_Lyr d:\Data\ark_data.gdb\ArkansasCityLimits d:\Data\ark_data.gdb\NhdMediumResLinesBeaver_WithinCityLimits #
Start Time: Tue May 11 16:59:24 2010
Reading Features...
Cracking Features...
Assembling Features...
Executed (Clip) successfully.
End Time: Tue May 11 16:59:27 2010 (Elapsed Time: 3.00 seconds) 
 
ESRI.ArcGIS.AnalysisTools.Clip clip =
                               new ESRI.ArcGIS.AnalysisTools.Clip();
clip.in_features = fc + "_Lyr";
// Clip the the city limits layer
clip.clip_features = "ArkansasCityLimits";
// Push out a new featureclass to our file geodatabase
clip.out_feature_class = fc + "_WithinCityLimits";

RunTool(gp, clip, null, lw);