<?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 Release lock on file geodatabase so it can be deleted in a python script? in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085093#M7309</link>
    <description>&lt;P&gt;Hello! I am working on a script that will archive layers from AGOL in a zipped geodatabase. When I get to the clean up section, the script fails, because it can't delete a geodatabase with a lock in it. The lock is created during the script processes, so it's not being used by another user. Is there a way to release the lock in the same script? Here's my general workflow:&lt;/P&gt;&lt;P&gt;1. Log in to AGOL&lt;/P&gt;&lt;P&gt;2. Create a geodatabase&lt;/P&gt;&lt;P&gt;3. Copy layers from AGOL to the geodatabase&lt;/P&gt;&lt;P&gt;4. Zip the geodatabase&lt;/P&gt;&lt;P&gt;5. Delete the unzipped geodatabase (script fails here due to lock)&lt;/P&gt;&lt;P&gt;I'm very new to python, fyi. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Any help is appreciated!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 20:17:16 GMT</pubDate>
    <dc:creator>MaryroseKulick</dc:creator>
    <dc:date>2021-08-02T20:17:16Z</dc:date>
    <item>
      <title>Release lock on file geodatabase so it can be deleted in a python script?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085093#M7309</link>
      <description>&lt;P&gt;Hello! I am working on a script that will archive layers from AGOL in a zipped geodatabase. When I get to the clean up section, the script fails, because it can't delete a geodatabase with a lock in it. The lock is created during the script processes, so it's not being used by another user. Is there a way to release the lock in the same script? Here's my general workflow:&lt;/P&gt;&lt;P&gt;1. Log in to AGOL&lt;/P&gt;&lt;P&gt;2. Create a geodatabase&lt;/P&gt;&lt;P&gt;3. Copy layers from AGOL to the geodatabase&lt;/P&gt;&lt;P&gt;4. Zip the geodatabase&lt;/P&gt;&lt;P&gt;5. Delete the unzipped geodatabase (script fails here due to lock)&lt;/P&gt;&lt;P&gt;I'm very new to python, fyi. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:17:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085093#M7309</guid>
      <dc:creator>MaryroseKulick</dc:creator>
      <dc:date>2021-08-02T20:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Release lock on file geodatabase so it can be deleted in a python script?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085109#M7310</link>
      <description>&lt;P&gt;The lock will not be released until the script is done.&amp;nbsp; You can use arcpy.env.overwriteOut = True to simply overwrite the existing gdb's namespace the next time the script is run.&amp;nbsp; Sometimes a bit of fluff lies around if you don't want to delete things manually or in a separate script&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 21:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085109#M7310</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-02T21:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Release lock on file geodatabase so it can be deleted in a python script?</title>
      <link>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085110#M7311</link>
      <description>&lt;P&gt;Update, I fixed the problem by using arpy.management.Delete() instead of&amp;nbsp; os.remove()&lt;/P&gt;&lt;P&gt;Thanks for the input!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 21:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/release-lock-on-file-geodatabase-so-it-can-be/m-p/1085110#M7311</guid>
      <dc:creator>MaryroseKulick</dc:creator>
      <dc:date>2021-08-02T21:12:28Z</dc:date>
    </item>
  </channel>
</rss>

