<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can't acquire a lock on table - but it's not being used by another process. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/can-t-acquire-a-lock-on-table-but-it-s-not-being/m-p/547180#M42692</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The code below, run as a script added in a toolbox to ArcMap, errors out as shown after a little over a minute. tempBuffer is created, the Case_ field is added, and the case number is added. Actually, only part of the case number was added. the number was ZFY-1234, and only -1234 was added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why would 1), this would take over a minute, 2) CalculateField not use the whole value and 3) most importantly, why raise this error? buffer_200 hasn't even had anything done to it yet. Editing the geodb with buffer_200 is started, but nothing's been done with that class prior to Append.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env

env.workspace = r"\\SDE.GDBServerPath\TestCases_Geodatabase.gdb"
case_number = arcpy.GetParameterAsText(0)
buffer_200 = "Buffer"

#-------------------------------------------------------------------------------
# Buffer Processing
#
def CreateBuffer():
&amp;nbsp;&amp;nbsp;&amp;nbsp; # set buffer parameters
&amp;nbsp;&amp;nbsp;&amp;nbsp; case = "Cases"
&amp;nbsp;&amp;nbsp;&amp;nbsp; output ="tempBuffer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; dist = "200 feet"
&amp;nbsp;&amp;nbsp;&amp;nbsp; side = "OUTSIDE_ONLY"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create temporary buffer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(case, output, dist, side)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # add Case_ field and set it's value to the case number
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(output, "Case_", "TEXT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(output, "Case_", case_number)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # copy tempBuffer to Buffer feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(output, buffer_200, "NO_TEST")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete tempBuffer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(output)

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateBuffer()

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshTOC
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error Message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Start Time: Thu Mar 22 12:50:21 2012
Running script BufferAndGetOwnerData...
&amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 999999: Error executing function.
Cannot acquire a lock.
Cannot acquire a lock. [The table Buffer is being written by another process.]
Cannot acquire a lock. [The table Buffer is being written by another process.]
Failed to execute (Append).

Failed to execute (BufferAndGetOwnerData).
Failed at Thu Mar 22 12:51:31 2012 (Elapsed Time: 1 minutes 10 seconds)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Mar 2012 17:09:53 GMT</pubDate>
    <dc:creator>Zeke</dc:creator>
    <dc:date>2012-03-22T17:09:53Z</dc:date>
    <item>
      <title>Can't acquire a lock on table - but it's not being used by another process.</title>
      <link>https://community.esri.com/t5/python-questions/can-t-acquire-a-lock-on-table-but-it-s-not-being/m-p/547180#M42692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The code below, run as a script added in a toolbox to ArcMap, errors out as shown after a little over a minute. tempBuffer is created, the Case_ field is added, and the case number is added. Actually, only part of the case number was added. the number was ZFY-1234, and only -1234 was added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why would 1), this would take over a minute, 2) CalculateField not use the whole value and 3) most importantly, why raise this error? buffer_200 hasn't even had anything done to it yet. Editing the geodb with buffer_200 is started, but nothing's been done with that class prior to Append.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env

env.workspace = r"\\SDE.GDBServerPath\TestCases_Geodatabase.gdb"
case_number = arcpy.GetParameterAsText(0)
buffer_200 = "Buffer"

#-------------------------------------------------------------------------------
# Buffer Processing
#
def CreateBuffer():
&amp;nbsp;&amp;nbsp;&amp;nbsp; # set buffer parameters
&amp;nbsp;&amp;nbsp;&amp;nbsp; case = "Cases"
&amp;nbsp;&amp;nbsp;&amp;nbsp; output ="tempBuffer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; dist = "200 feet"
&amp;nbsp;&amp;nbsp;&amp;nbsp; side = "OUTSIDE_ONLY"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create temporary buffer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(case, output, dist, side)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # add Case_ field and set it's value to the case number
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(output, "Case_", "TEXT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(output, "Case_", case_number)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # copy tempBuffer to Buffer feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(output, buffer_200, "NO_TEST")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # delete tempBuffer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(output)

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateBuffer()

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshTOC
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error Message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Start Time: Thu Mar 22 12:50:21 2012
Running script BufferAndGetOwnerData...
&amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 999999: Error executing function.
Cannot acquire a lock.
Cannot acquire a lock. [The table Buffer is being written by another process.]
Cannot acquire a lock. [The table Buffer is being written by another process.]
Failed to execute (Append).

Failed to execute (BufferAndGetOwnerData).
Failed at Thu Mar 22 12:51:31 2012 (Elapsed Time: 1 minutes 10 seconds)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 17:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-acquire-a-lock-on-table-but-it-s-not-being/m-p/547180#M42692</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-03-22T17:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can't acquire a lock on table - but it's not being used by another process.</title>
      <link>https://community.esri.com/t5/python-questions/can-t-acquire-a-lock-on-table-but-it-s-not-being/m-p/547181#M42693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Temporary tables are better written to a local temporary file geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any analysis output written across a network is subject to timeouts, so avoid it and just copy the final result across.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides it will be much faster. Even faster if you use" in_memory", a special virtual disk location, for small featureclasses.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set arcpy.env.overwriteOutput = True so that you can rerun the script without tripping over the first aborted run.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Even then, if you have a crash inside Pythonwin you may need to cleanup and close open files. This was a bit easier with the gp object, with del gp, but now you might have to reopen the GUI, or even log off to cleanup.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 19:29:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/can-t-acquire-a-lock-on-table-but-it-s-not-being/m-p/547181#M42693</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2012-03-26T19:29:44Z</dc:date>
    </item>
  </channel>
</rss>

