<?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 check to see if workspace is being edited in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746934#M57733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, just a quick thing that I'd really like to add to a ToolValidator script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to see if a geodatabase that I have as an input parameter is currently being edited?&amp;nbsp; I'm running Python 2.6.6 and 10.0 SP5.&amp;nbsp; It looks like I'd be able to do this with 10.1 and the arcpy.da module, but maybe there's a way with what I have..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jan 2013 15:25:24 GMT</pubDate>
    <dc:creator>AdamCox1</dc:creator>
    <dc:date>2013-01-22T15:25:24Z</dc:date>
    <item>
      <title>check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746934#M57733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, just a quick thing that I'd really like to add to a ToolValidator script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to see if a geodatabase that I have as an input parameter is currently being edited?&amp;nbsp; I'm running Python 2.6.6 and 10.0 SP5.&amp;nbsp; It looks like I'd be able to do this with 10.1 and the arcpy.da module, but maybe there's a way with what I have..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adam&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 15:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746934#M57733</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2013-01-22T15:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746935#M57734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; import glob&amp;nbsp; &amp;gt;&amp;gt;&amp;gt; if glob.glob(r'C:\Users\bk6128\Documents\ArcGIS\solarTest.gdb\*.lock'): ...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print True&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 17:00:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746935#M57734</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2013-01-22T17:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746936#M57735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kevin, thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will return true no problem, but after I stop the editing session, it still returns true...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 17:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746936#M57735</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2013-01-22T17:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746937#M57736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;FYI- If you have an instance of ArcMap or ArcCatalog thats pointing to the database, then there is always a lock file. Try closing your instances of ArcMap/ Catalog and run the script again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 18:39:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746937#M57736</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2013-01-22T18:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746938#M57737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK, making progress.&amp;nbsp; When run from IDLE, with or without ArcMap open, it works with a slight modification: using *.ed.lock instead of *.lock.&amp;nbsp; There are a bunch of lock files in there, but when an edit session is started, a file is created for each layer ending in ".ed.lock".&amp;nbsp; No problem to search for those.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I'm not able to get it to run correctly from ToolValidator.&amp;nbsp; It won't return an error when it should.&amp;nbsp; In the updateMessage class I have&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os.path, glob
if self.params[0].altered:
&amp;nbsp; if glob.glob(str(self.params[0].value) + '*.ed.lock'):
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[0].setErrorMessage("Close edit session in Target Geodatabase before continuing.")
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also tried with hardcoding the .gdb path instead of using str(self.params[0].value).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When run from here, perhaps it will not recognize individual files within a .gdb, only feature classes, etc?&amp;nbsp; I also tried os.path.isfile instead of glob.glob but with no luck...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746938#M57737</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2021-12-12T07:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: check to see if workspace is being edited</title>
      <link>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746939#M57738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just revisited this, and figured out that my problem was just a silly little detail and glob is perfect after all; I forgot to add "\\" in my string.&amp;nbsp; So, this is all the code I need to put into ToolValidator to test whether an input file geodatabase is in an edit session:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import glob
if glob.glob(str(self.params[0].value) + '\\*.ed.lock'):
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[0].setErrorMessage("Close edit session.")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I'm going to use it in all my tools...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:46:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-to-see-if-workspace-is-being-edited/m-p/746939#M57738</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2021-12-12T07:46:07Z</dc:date>
    </item>
  </channel>
</rss>

