<?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 how to disconnect user locks from file geodatabase in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589678#M46216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;the File Geodatabase is a ArcGIS term which uses a file folder structure to store geo enabled data. For one of my data maintenance nightly process i use python scripting to stop &amp;amp; block connections to my enterprise SQL database by using the commands... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;_________________________________________________________________________________&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Set the necessary product code&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;import arcinfo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;import arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Local variables:&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__2_ = OwnerCurrentYr_sde&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__3_ = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__7_ = OwnerCurrentYr_sde__3_&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__5_ = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__6_ = OwnerCurrentYr_sde__5_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Stop new connections&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.AcceptConnections("Database Connections\\OwnerCurrentYr.sde", False)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Process: Disconnect all users &lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.DisconnectUser("Database Connections\\OwnerCurrentYr.sde", "ALL")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;...... i then do other tasks to compress database, rebuild indexes, Analyze datasets and then i allow connections to begin connecting to the SQL database.&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Enable users to begin connections&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.AcceptConnections("Database Connections\\OwnerCurrentYr.sde", True)&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;_______________________________________________________________________________&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #333333; font-size: 14px;"&gt;The above workflow works great for the SQL connections , but how do i do this for a file geodatabase?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2016 19:52:14 GMT</pubDate>
    <dc:creator>BryanPrice</dc:creator>
    <dc:date>2016-10-05T19:52:14Z</dc:date>
    <item>
      <title>how to disconnect user locks from file geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589678#M46216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;the File Geodatabase is a ArcGIS term which uses a file folder structure to store geo enabled data. For one of my data maintenance nightly process i use python scripting to stop &amp;amp; block connections to my enterprise SQL database by using the commands... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;_________________________________________________________________________________&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Set the necessary product code&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;import arcinfo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;import arcpy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Local variables:&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__2_ = OwnerCurrentYr_sde&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__3_ = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__7_ = OwnerCurrentYr_sde__3_&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__5_ = "Database Connections\\OwnerCurrentYr.sde"&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;OwnerCurrentYr_sde__6_ = OwnerCurrentYr_sde__5_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Stop new connections&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.AcceptConnections("Database Connections\\OwnerCurrentYr.sde", False)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Process: Disconnect all users &lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.DisconnectUser("Database Connections\\OwnerCurrentYr.sde", "ALL")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;...... i then do other tasks to compress database, rebuild indexes, Analyze datasets and then i allow connections to begin connecting to the SQL database.&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;# Enable users to begin connections&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;arcpy.AcceptConnections("Database Connections\\OwnerCurrentYr.sde", True)&lt;/SPAN&gt;&lt;BR style="color: #333333; background-color: #ffffff; font-size: 14px;" /&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 14px;"&gt;_______________________________________________________________________________&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #333333; font-size: 14px;"&gt;The above workflow works great for the SQL connections , but how do i do this for a file geodatabase?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 19:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589678#M46216</guid>
      <dc:creator>BryanPrice</dc:creator>
      <dc:date>2016-10-05T19:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to disconnect user locks from file geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589679#M46217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bryan,&lt;/P&gt;&lt;P&gt;I have not been successful in totally disconnecting users from a FGDB, short of maybe a reboot of the fgdb machine.... or maybe somehow blocking access to the folder completely, but even with that, with windows, my guess is permission connections would persist until a reboot or logout/in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am making progress in finding if the fgdb is in used or accessed in anyway. We've had an issue today were an mxd is opening file gdb files, in Windows point-of-view, but is not creating any .lock files.&amp;nbsp; I was testing for the existence of the .locks before I renamed or deleted a file gdb.&amp;nbsp; The rename would just fail, but the delete would delete all but about 5 files, but the file gdb would now be corrupt, with an folder with the .gdb extension that could no longer be deleted.&amp;nbsp; and testing with arcpy.Exists no longer sees the folder as a gdb.&amp;nbsp; However, those un-deleted files are still open by the user(s)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can restore the fgdb by copying the files that were deleted from the fgdb file from a backup, but this is an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been using the&amp;nbsp; FSMGMT.MSC and the&amp;nbsp; NET FILES&amp;nbsp; windows commands to help find these hidden locks, but so far have only had success running them manually.&amp;nbsp; I'm trying to figure out how to capture this info in my python script BEFORE attempting the rename.&amp;nbsp; ....anyone have any ideas?&amp;nbsp; (not trying to hijack this thread...so will spin off if anyone does).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the various threads I've seen that talk about the FSMGMT.MSC command, there is a command line that says you can /close the files, but so far, this has not closed connection to the fgdb if they have it open in an mxd for example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;One issue with trying to run the NET FILES is it needs to be run as an administrator.&amp;nbsp; I've seen some talk about creating a bat file or using &lt;EM&gt;import subprocess &lt;/EM&gt;to run this, but I haven't figured that out yet, our how to capture or query the output for the fgdb in questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, you are not alone in trying to figure this out.&amp;nbsp; I&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some links of interest that I've been working thru&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.esri.com/thread/53359#comment-265240" title="https://community.esri.com/thread/53359#comment-265240"&gt;https://community.esri.com/thread/53359#comment-265240&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a stackexchange with the same info&amp;nbsp; &lt;A class="link-titled" href="http://gis.stackexchange.com/questions/80861/problems-with-a-filegeodatabase-locking" title="http://gis.stackexchange.com/questions/80861/problems-with-a-filegeodatabase-locking"&gt;arcgis 10.0 - Problems with a FileGeodatabase locking - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://wiert.me/2012/12/03/commandline-equivalents-for-fsmgmt-msc-net-share-net-view-net-session-net-file-net-use/" title="https://wiert.me/2012/12/03/commandline-equivalents-for-fsmgmt-msc-net-share-net-view-net-session-net-file-net-use/"&gt;https://wiert.me/2012/12/03/commandline-equivalents-for-fsmgmt-msc-net-share-net-view-net-session-net-file-net-use/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW- I have several snippets written using various tests, looking for the locks if you are interested.&amp;nbsp; Once I figure this all out, I hope to summarize and post as a doc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 23:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589679#M46217</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-10-05T23:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to disconnect user locks from file geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589680#M46218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a solution to share here - that would be fantastic. I have been trying to resolve this issue for some time as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 14:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589680#M46218</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-09-17T14:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to disconnect user locks from file geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589681#M46219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this thread is a few months old but I found a workaround for my issue that might be related. I have a routine that updates crime data each morning by downloading files from a ftp, does some processing and geocoding to update their data. After banging my head against the wall to get them to close out their arcmap and catalog every night, I came up with this solution. I work off a FGDB on my computer that I know wont have a lock on it. Then at the end, I try to delete their FGDB and replace with my version. So I run the script as if the users closed out arcmap/catalog and use a try/catch to look for these errors.&lt;/P&gt;&lt;P&gt;000725: Dataset already exists.&amp;nbsp;&lt;/P&gt;&lt;P&gt;000601:&amp;nbsp;Cannot delete &amp;lt;value&amp;gt;. May be locked by another application.&lt;/P&gt;&lt;P&gt;000012: &amp;lt;value&amp;gt; already exists.&lt;/P&gt;&lt;P&gt;If I catch any of these, I just copy every file inside the FGDB folder from mine to theirs except the lock caused by my script. Been running for sometime like this with no issues. Below is the tail end of the script where the delete starts and the except is. FYI, notify() is a custom script that sends emails to me so I know what happens as this runs at 5:30 am.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    errMsg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Delete DJJ gdb'&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;errMsg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pdfsmain&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    errMsg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'copy new DJJ'&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;errMsg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Copy_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;csv_loc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pdfsmain&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    
    notify&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"PDA DJJ update complete"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subject&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; from_add&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; to_add&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'done'&lt;/SPAN&gt;   
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        e &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exc_info&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ERROR 000725:"&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;args&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ERROR 000601:"&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;args&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ERROR 000012:"&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;args&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Error trapped"&lt;/SPAN&gt;
            lst &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listdir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;csv_loc&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; f
                &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"lock"&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
                    shutil&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;copy2&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb\\{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;csv_loc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'{}\\DJJ_Data.gdb\\{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pdfsmain&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'copied'&lt;/SPAN&gt;
            notify&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Copied files because of lock'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subject&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; from_add&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; to_add&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            msg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Update DJJ fGDB failed: %s \n with: %s \n and %s"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetMessages&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;errMsg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            notify&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;msg&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subject&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; from_add&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; to_add&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'failed'&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-disconnect-user-locks-from-file-geodatabase/m-p/589681#M46219</guid>
      <dc:creator>MichaelKohler</dc:creator>
      <dc:date>2021-12-12T01:19:55Z</dc:date>
    </item>
  </channel>
</rss>

