<?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 Locks persistent even having finished the geoprocess in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71504#M5882</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I developed a Python script that reads a feature class in a file geodatabase and added to a mxd through arcpy.mapping library functions. The process is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(env.workspace + "\\" + s, aux) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;addLayer = arcpy.mapping.Layer(aux) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.AddLayer(df, addLayer, "BOTTOM") &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del addLayer, aux, df &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.save() &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = ""; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even removing all references of the del command, I still maintain the following blocks in the File GDB to the features that add to the mxd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_gdb.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anno_dee.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Annotation1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polyline1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to delete the mxd generated but locks persist. This creates a big problem to me because the process then has a process of erasing entities of the GDB and clear, with the active locks I can not run the delete of each feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed that just is arcpy.mapping.AddLayer line (df, addLayer, "BOTTOM") that generates the locks because if they put that line of code not generated, but brother python script ends are not released.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2011 06:52:35 GMT</pubDate>
    <dc:creator>BorjaParés</dc:creator>
    <dc:date>2011-09-21T06:52:35Z</dc:date>
    <item>
      <title>Locks persistent even having finished the geoprocess</title>
      <link>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71504#M5882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I developed a Python script that reads a feature class in a file geodatabase and added to a mxd through arcpy.mapping library functions. The process is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(env.workspace + "\\" + s, aux) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;addLayer = arcpy.mapping.Layer(aux) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.AddLayer(df, addLayer, "BOTTOM") &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del addLayer, aux, df &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.save() &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = ""; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even removing all references of the del command, I still maintain the following blocks in the File GDB to the features that add to the mxd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_gdb.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anno_dee.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Annotation1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Point1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polyline1.MAD0WK198.1104.5048.sr.lock &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to delete the mxd generated but locks persist. This creates a big problem to me because the process then has a process of erasing entities of the GDB and clear, with the active locks I can not run the delete of each feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I noticed that just is arcpy.mapping.AddLayer line (df, addLayer, "BOTTOM") that generates the locks because if they put that line of code not generated, but brother python script ends are not released.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 06:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71504#M5882</guid>
      <dc:creator>BorjaParés</dc:creator>
      <dc:date>2011-09-21T06:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Locks persistent even having finished the geoprocess</title>
      <link>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71505#M5883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried deleting the feature layer you created with arcpy.Delete_management?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way I usually do it is this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lyrPoly = "lyrPoly"
arcpy.MakeFeatureClass(fc,lyrPoly)
...
arcpy.Delete_management(lyrPoly)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71505#M5883</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-10T22:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Locks persistent even having finished the geoprocess</title>
      <link>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71506#M5884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This has been a major problem for me in the past and I posted the problem with personal geodatabases some time ago. The issue was supposed to be fixed with file geodatabases, but I've experienced problems. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Schema locks are not "going away" because they are critically needed to prevent destruction of geodatabase data. Personal geodatabase locks were a pain because a lock applied to the entire geodatabase (.mdb file). File geodatabase locks still exist, but they only applied to one feature class or table at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The help has been updated with some very useful details on this topic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003n0000002m000000.htm"&gt;&lt;BR /&gt;'&amp;gt;Schema locking&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/"&gt;&lt;/A&gt;&lt;A&gt;File geodatabases and locking&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 19:20:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71506#M5884</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2011-09-23T19:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Locks persistent even having finished the geoprocess</title>
      <link>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71507#M5885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have had problems with this also, but not in cases as simple as the original posters. Locks sometimes take a long time &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;(well... long time for a computer) &lt;/SPAN&gt;&lt;SPAN&gt;to clear, which is a huge pain in the ass. If you really need to do something that requires accessing the same .gdb quickly you are probably best to reconsider your entire method. I got around it once by doing all my calculations in Python, storing my temporary data in Python objects and writing to the output file only once with an UpdateCursor...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI &lt;/SPAN&gt;&lt;A href="http://sgillies.net/blog/1067/get-with-it/"&gt;this blog post&lt;/A&gt;&lt;SPAN&gt;, and the comments, discuss the issues pretty well, with regard to Cursors.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Sep 2011 01:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-persistent-even-having-finished-the/m-p/71507#M5885</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2011-09-24T01:31:47Z</dc:date>
    </item>
  </channel>
</rss>

