<?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 Re: Locks left on shapefiles when using SelectLayerBy tools in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745148#M57605</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are running a script and not doing the process line-by-line, then you shouldn't have issues with locks.&lt;/P&gt;&lt;P&gt;You might want to try deleting the python variables if you have them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most IDE's have a 'delete variable names' and a restart kernel (like Spyder) so you don't need a complete shutdown of the IDE (although it provides a suitable coffee break time)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Mar 2020 21:19:00 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2020-03-30T21:19:00Z</dc:date>
    <item>
      <title>Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745147#M57604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recently switched from Desktop to Pro and have run into a problem with locks being left on shapefiles when I use SelectLayerByAttribute or SelectLayerByLocation.&amp;nbsp; Both the &lt;A href="https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/select-layer-by-attribute.htm#C_GUID-86CECCE8-F387-4EEE-BEBA-4663E7088910"&gt;Desktop &lt;/A&gt;and &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-attribute.htm#C_GUID-86CECCE8-F387-4EEE-BEBA-4663E7088910"&gt;Pro&lt;/A&gt; documentation show the same stand-alone script for both tools, though the Pro version of the script is a bit different.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESKTOP:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;env&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;workspace&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"c:/data/mexico.gdb"&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="" style="color: green; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;# Make a layer from the feature class&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;MakeFeatureLayer_management&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"cities"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="" style="color: green; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;# Select all cities which overlap the chihuahua polygon&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;SelectLayerByLocation_management&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"intersect"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"chihuahua"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafafa; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;"new_selection"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PRO:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;arcpy.env.workspace = &lt;/SPAN&gt;&lt;SPAN class="" style="color: #c41a16; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;'c:/data/mexico.gdb'&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #006a00; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;# Select all cities which overlap the chihuahua polygon&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;chihuahua_cities = arcpy.SelectLayerByLocation_management(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #c41a16; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;'cities'&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="" style="color: #c41a16; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;'INTERSECT'&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="" style="color: #c41a16; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;'chihuahua'&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="" style="color: #1c00cf; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="" style="color: #c41a16; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN style="color: #595959; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, monospace; font-size: 14.45px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #f8f8f8; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Desktop sample shows using MakeFeatureLayer to create a feature layer out of the cities feature class, then passing that as the first argument to the SelectLayerByLocation tool.&amp;nbsp; The Pro sample doesn't bother to create a feature layer first; it simply plugs in the feature class ('cities'). &amp;nbsp; The Pro sample also shows storing a returned object in a variable (chihuahua_cities).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I've used these tools on shapefiles in Desktop, I've always used MakeFeatureLayer as shown in the sample.&amp;nbsp; It places a lock on the shapefile, but I can remove the lock by using Delete when I'm done (in this case, I'd do arcpy.Delete_management("lyr")).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to follow the syntax shown in the Pro help (storing the returned object in a variable), I also get a lock placed on the shapefile, but I haven't found a way to remove the lock aside from closing my IDE.&amp;nbsp; I've tried:&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(chihuahua_cities)&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(chihuahua_cities[0])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But neither actually removes the lock.&amp;nbsp; I can continue to code it the way that's shown in the Desktop help, but was wondering if there was a fix to the problem that follows the syntax shown in the Pro help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2020 21:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745147#M57604</guid>
      <dc:creator>JimDetwiler1</dc:creator>
      <dc:date>2020-03-30T21:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745148#M57605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are running a script and not doing the process line-by-line, then you shouldn't have issues with locks.&lt;/P&gt;&lt;P&gt;You might want to try deleting the python variables if you have them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most IDE's have a 'delete variable names' and a restart kernel (like Spyder) so you don't need a complete shutdown of the IDE (although it provides a suitable coffee break time)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2020 21:19:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745148#M57605</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-30T21:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745149#M57606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick reply.&amp;nbsp; I had been running line by line, but just tried running it normally and the locks are still there.&amp;nbsp; I had also already tried del &lt;EM&gt;variable&lt;/EM&gt;, but that doesn't remove the lock either.&amp;nbsp; And I discovered the Restart option in Spyder because of this issue.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 00:34:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745149#M57606</guid>
      <dc:creator>JimDetwiler1</dc:creator>
      <dc:date>2020-03-31T00:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745150#M57607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmmm&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-location.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-location.htm"&gt;Select Layer By Location—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;Determines how the selection will be applied to the input and how to combine it with an existing selection. Note that there is no option here to clear an existing selection. To clear a selection, use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="background-color: #ffffff; font-weight: 300; font-size: 14.875px;"&gt;CLEAR_SELECTION&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;option on the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;Select Layer By Attribute&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tool.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are doing it line by line, why not whip in a&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-attribute.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-attribute.htm"&gt;Select Layer By Attribute—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the above clearing the selection to see if that does anything&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that you have Pro open when you are doing this, which may also be an issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 01:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745150#M57607</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-31T01:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745151#M57608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No effect after adding SelectLayerByAttribute with CLEAR_SELECTION.&amp;nbsp; Yes, I've had Pro open.&amp;nbsp; I just tried again with Pro closed, but no difference. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation says the tools return a &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/classes/result.htm"&gt;Result&lt;/A&gt; object, so I've also tried using getOutput(0) and using Delete on that object.&amp;nbsp; And I've tried doing setSelectionSet([]).&amp;nbsp; No luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 02:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745151#M57608</guid>
      <dc:creator>JimDetwiler1</dc:creator>
      <dc:date>2020-03-31T02:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745152#M57609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Turn it into a script, run it.&amp;nbsp; Python won't lock it, and if the lock is there it is a Pro issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, dump the shapefile and try it with a featureclass in a gdb&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 02:12:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745152#M57609</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-31T02:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745153#M57610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry if I wasn't clear.&amp;nbsp; I am running a script in Spyder.&amp;nbsp; I've tried stepping through it with the debugger and I've tried just running it normally with the same result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And what I'm talking about happening is a .lock file appears in my Windows File Explorer as soon as I run SelectLayerByLocation or SelectLayerByAttribute.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just put my data into a file GDB and ran the script on it with the same result.&amp;nbsp; When I look inside the .gdb folder, a .lock file appears after running SelectLayerByLocation.&amp;nbsp; If I try using Delete on the object returned by the tool, the .lock file persists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if I run these tools the way they're demonstrated in the Desktop help -- creating a layer using MakeFeatureLayer, using the layer as an input to the tool, then running Delete on the layer when I'm done with it -- the&amp;nbsp; lock file immediately disappears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you could try it and see if you get the same behavior?&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;lyr= arcpy.SelectLayerByAttribute_management(yourFC, 'NEW_SELECTION', yourWhereClause)&lt;/P&gt;&lt;P&gt;arcpy.Delete_management(lyr)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 03:14:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745153#M57610</guid>
      <dc:creator>JimDetwiler1</dc:creator>
      <dc:date>2020-03-31T03:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745154#M57611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

f &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Git_Dan\npgeom\Project_npg\npgeom.gdb\Polygons2"&lt;/SPAN&gt;

res &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'"OBJECTID" &amp;gt; 1'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

res&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;&amp;lt;&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer at &lt;SPAN class="number token"&gt;0x18f06bc35f8&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;

res&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="string token"&gt;'2'&lt;/SPAN&gt;

res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getInput&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="string token"&gt;'C:\\Git_Dan\\npgeom\\Project_npg\\npgeom.gdb\\Polygons2'&lt;/SPAN&gt;

res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getInput&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="string token"&gt;'NEW_SELECTION'&lt;/SPAN&gt;

res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&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;&amp;lt;&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer at &lt;SPAN class="number token"&gt;0x18f06bc5fd0&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;

res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cancel&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; res

&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;P&gt;Lock remained until the kernel was restarted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Project not opened, lock file had a size of 0 bytes.&lt;/P&gt;&lt;P&gt;Delete_management did squat.&lt;/P&gt;&lt;P&gt;del res killed it in python and wasn't available after line 24.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So script or no script.... locks remain until the calling/using thread was terminated.. which sort of makes sense to me, just in case you might want to use the selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear_selection, cleared it, but produces another result (getting a headache) and the lock remained.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Restarting the kernel killed the process and the lock went away (and I got coffee).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what I didn't do was try Copy_management to save the result to disk to see if that freed the lock.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745154#M57611</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T07:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745155#M57612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://support.esri.com/en/technical-article/000011134" title="https://support.esri.com/en/technical-article/000011134"&gt;FAQ: Why am I getting schema locks on shapefiles?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;effectively, the observations are as expected since they don't persist on process close&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 07:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745155#M57612</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-31T07:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745156#M57613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again for your help, Dan.&amp;nbsp; For background, I teach an introductory Python scripting class and have always operated under the assumption that scripts shouldn't leave locks in place when they've finished.&amp;nbsp; I see that after running my script I can open Pro and edit a shapefile that had a lock created on it by my script, so I guess it's a "benign" one.&amp;nbsp; Still, it would be nice if I didn't have to try to explain that locks are sometimes a problem, sometimes not.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 14:30:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745156#M57613</guid>
      <dc:creator>JimDetwiler1</dc:creator>
      <dc:date>2020-03-31T14:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745157#M57614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well I just finished 30+ years of teaching... so enjoy! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I think the file size of 0 bytes is important and that i could repeat the selection that it is benign.&amp;nbsp; The help files contain information on when a lock is an issue and for the most part, it is the "sharesies thing" with multiple people potentially using the same data. I also think python might be done with "arc stuff" when you delete it and it is garbage collected... but that doesn't mean that arc is done with python until you kill the python thread that is running then there is nothing left to hand on to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2020 16:02:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/745157#M57614</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-31T16:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/1184700#M64798</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/208026"&gt;@JimDetwiler1&lt;/a&gt;&amp;nbsp; thanks for posting this issue report and &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1066"&gt;@DanPatterson_Retired&lt;/a&gt;&amp;nbsp; for confirming the behavior. For reference I created a script tool to iteratively do select by location so that I could attribute features that were connected together. This script works fine in the python command line in pro, but run as a script tool it will run once and then I can't select any other features afterwards. Resolution so far has been to shutdown and restart Pro.&amp;nbsp; I don't know if someone could look at this issue again and maybe create a suitable resolution to kill the lock on the selected object? If not at least thank you for explaining all of this.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 15:22:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/1184700#M64798</guid>
      <dc:creator>MichaelWallace3</dc:creator>
      <dc:date>2022-06-21T15:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Locks left on shapefiles when using SelectLayerBy tools</title>
      <link>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/1272391#M67258</link>
      <description>&lt;P&gt;Left behind locks are a big issue within arcpy and we struggle with that almost every day. There are several arcpy functions which are not cleaning up lock files, respectively the resources are only unlocked after the Python process terminates. This is cumbersome, not best practise and results in many problems. For example serially running geo processing tools can stumble across lock files from previous steps. Moving or deleting the processed data afterwards is not possible with locks.&lt;/P&gt;&lt;P&gt;A few months ago, we tried to explain the general problem to Esri support with a ticket and a simple use case:&lt;/P&gt;&lt;PRE&gt;arcpy.Exists(path/to/a/gdb)&lt;/PRE&gt;&lt;PRE&gt;shutil.rmtree(path/to/a/gdb)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The code fails because of locks (PermissionError), which is not expected.&lt;/P&gt;&lt;P&gt;The answer from Esri support showed us, that the message of this general problem has not been received: &lt;EM&gt;"When this script is run it fails on "shutil.rmtree(path/to/a/gdb) [...] It would not be considered an Esri product in what we are responsible for. [...] When the python process is closed the lock goes away."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So we remain stuck with our workaround to use the multiprocessing library of Python to run affected arcpy functions in separate processes. Because these separate processes terminate, the lock files are cleared and the main process can go on without any problems.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/locks-left-on-shapefiles-when-using-selectlayerby/m-p/1272391#M67258</guid>
      <dc:creator>Adrian</dc:creator>
      <dc:date>2023-03-28T12:22:17Z</dc:date>
    </item>
  </channel>
</rss>

