<?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: arcpy.mp.ArcGISProject .aprx lock issue in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1567889#M91207</link>
    <description>&lt;P&gt;Hey Meghan,&lt;/P&gt;&lt;P&gt;No, I did not find a solution. I encountered this same issue, re: multiple locked projects. I have an output directory where all projects go when my GP tool is run, and I would find that if I executed multiple test runs back-to-back, each folder in that directory created by each test run could not be deleted because somehow they all had files open somewhere, even though Pro was not open, and neither was an active debugging session in my IDE where I developed the tool's script.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2024 17:07:54 GMT</pubDate>
    <dc:creator>__JackCharde__</dc:creator>
    <dc:date>2024-12-12T17:07:54Z</dc:date>
    <item>
      <title>arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398589#M80689</link>
      <description>&lt;P&gt;Hey Everyone,&lt;/P&gt;&lt;P&gt;I wrote a python script for a client that extracts a project template to a new folder, manipulates the data and layouts in that new project, creates PDFs, saves a copy of that extracted project file with the current month/year, and then tries to delete the extracted project. The deletion always fails, and my VS Code terminal or the GP tool I built the script for says it's because the project is open somewhere.&lt;/P&gt;&lt;P&gt;I have tried deleting every variable that references the project, maps, layouts, elements, all arcpy.mp classes for that matter, and it still always fails.&lt;/P&gt;&lt;P&gt;Even if I close Pro where I ran the GP tool, or close VS Code where I was debugging the script and then go to File Explorer to delete the extracted Pro project, File Explorer says I can't because the file is open somewhere,&amp;nbsp;&lt;EM&gt;which it is not&lt;/EM&gt; when looking at my computer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone encountered this, and/or know a way around it?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;- Jack C&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 17:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398589#M80689</guid>
      <dc:creator>__JackCharde__</dc:creator>
      <dc:date>2024-03-20T17:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398613#M80692</link>
      <description>&lt;P&gt;I have no experience with the workflow you’re referencing but I wonder if the project has any feature services as a data source? Until the service is shutdown I would guess an error similar to this would occur. This is only a complete guess.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 17:40:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398613#M80692</guid>
      <dc:creator>Eugene_Adkins</dc:creator>
      <dc:date>2024-03-20T17:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398660#M80701</link>
      <description>&lt;P&gt;Hey Eugene,&lt;/P&gt;&lt;P&gt;I appreciate the reply. Currently, all data sources reference file geodatabase feature classes. When this issue first occurred, I checked Task Manager's&amp;nbsp;&lt;EM&gt;Processes&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;Details&lt;/EM&gt; panes to see if anything related to Pro was still active and did see ArcGISPro.exe in the&amp;nbsp;&lt;EM&gt;Details&lt;/EM&gt; pane, even though Pro was not open. I found that odd, but then didn't see it again, even though the issue persisted.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 18:58:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398660#M80701</guid>
      <dc:creator>__JackCharde__</dc:creator>
      <dc:date>2024-03-20T18:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398668#M80702</link>
      <description>&lt;P&gt;My understanding of the lock behavior is that lock&amp;nbsp;&lt;EM&gt;files&lt;/EM&gt; are created and stored somewhere in the directory for GDBs, and I would assume something similar is happening for the APRX.&amp;nbsp; If that lock file isn't properly cleaned up, then the software assumes someone somewhere is using it, even if they aren't.&lt;/P&gt;&lt;P&gt;It's like seeing antibodies and assuming the presence of a disease, even if the antibodies are just left behind and the disease was eradicated.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 19:10:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398668#M80702</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2024-03-20T19:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398723#M80708</link>
      <description>&lt;P&gt;So there was an enhancement request, ENH-000140298 -&amp;nbsp;&lt;SPAN&gt;Add a method to the arcpy.mp.ArcGISProject() object that will close the project and release locks held by a script.&amp;nbsp; But it was marked as "will not be addressed."&amp;nbsp; The explanation was "Locks on a project file can be eliminated by either closing the Python shell (vs the script editor) or by calling del on the appropriate variables. The method has little value when run in a script outside of the application and also inside the application."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 20:34:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1398723#M80708</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2024-03-20T20:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1408692#M81738</link>
      <description>&lt;P&gt;Hey Robert,&lt;/P&gt;&lt;P&gt;Thanks for the reply and info about that enhancement request. The problem is, however, that I do delete all appropriate variables in an attempt to remove a lock, and it still doesn't work. I decided to switch from Extract Package to aprx.saveACopy(). Somehow when I run my GP tool with Pro open, even though the project it's working on &lt;EM&gt;is&lt;/EM&gt; &lt;EM&gt;not&amp;nbsp;&lt;/EM&gt;open in Pro, I can't delete it unless I close all instances of Pro. This is even if I delete all variables referencing class objects that are part of arcpy.mp.ArcGISProject .&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 18:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1408692#M81738</guid>
      <dc:creator>__JackCharde__</dc:creator>
      <dc:date>2024-04-11T18:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1408763#M81744</link>
      <description>&lt;P&gt;Certainly Jack - happy to assist where I can.&amp;nbsp; Have you contacted Esri Support Services to see if they can assist you further?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 21:19:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1408763#M81744</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2024-04-11T21:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1517941#M86742</link>
      <description>&lt;P&gt;Did you ever find a solution? I have multiple projects locked in read-only after automating with&amp;nbsp;&lt;SPAN&gt;arcpy.mp.ArcGISProject() function. I have tried del on the objects but its not working.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2024 22:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1517941#M86742</guid>
      <dc:creator>MeghanBlair</dc:creator>
      <dc:date>2024-08-10T22:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1518418#M86785</link>
      <description>&lt;P&gt;No solution as of yet.&amp;nbsp; Question - are you using a file geodatabase or an enterprise geodatabase?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 15:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1518418#M86785</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2024-08-12T15:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1518465#M86792</link>
      <description>&lt;P&gt;Enterprise geodatabase&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 16:45:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1518465#M86792</guid>
      <dc:creator>MeghanBlair</dc:creator>
      <dc:date>2024-08-12T16:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1524049#M87174</link>
      <description>&lt;P&gt;I am also having this issue, running .py locally via automated trigger. Currently, there are approximately 12 scripts that are all similarly configured and there are 4 of them that have gotten all the way to the directive to overwrite an existing feature service and failed.&lt;/P&gt;&lt;P&gt;In troubleshooting (nothing has changed recently, these have been running automatically for over a year without issue) the only common factor that I can find is that those .aprx projects are locked as [READONLY].&lt;/P&gt;&lt;P&gt;I am able to manually open each project and overwrite the feature layers but that defeats the point of automation.&lt;/P&gt;&lt;P&gt;How do I remove the lock on these projects?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 21:11:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1524049#M87174</guid>
      <dc:creator>ElisseDeleissegues1</dc:creator>
      <dc:date>2024-08-19T21:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1550948#M89378</link>
      <description>&lt;P&gt;I'm having the same issue where I delete all aprx-related variables at the end of my script, the script completes, and aprx is still locked when I run aprx.save(). Seriously, ESRI? You think that restarting my python shell is an acceptable solution? Ever heard of scheduled tasks? Because locks seriously get in the way of that when the script is run automatically.&lt;/P&gt;&lt;P&gt;I am simply using .tif files in my .aprx project.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 15:50:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1550948#M89378</guid>
      <dc:creator>NseaGIS</dc:creator>
      <dc:date>2024-10-22T15:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1567889#M91207</link>
      <description>&lt;P&gt;Hey Meghan,&lt;/P&gt;&lt;P&gt;No, I did not find a solution. I encountered this same issue, re: multiple locked projects. I have an output directory where all projects go when my GP tool is run, and I would find that if I executed multiple test runs back-to-back, each folder in that directory created by each test run could not be deleted because somehow they all had files open somewhere, even though Pro was not open, and neither was an active debugging session in my IDE where I developed the tool's script.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 17:07:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1567889#M91207</guid>
      <dc:creator>__JackCharde__</dc:creator>
      <dc:date>2024-12-12T17:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1567893#M91208</link>
      <description>&lt;P&gt;Hey Robert,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the &lt;EM&gt;very&lt;/EM&gt; delayed reply. I did not contact support, but I definitely should!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 17:08:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1567893#M91208</guid>
      <dc:creator>__JackCharde__</dc:creator>
      <dc:date>2024-12-12T17:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1595436#M93985</link>
      <description>&lt;P&gt;I've been encountering issues with feature classes in geodatabases and arcgis pro projects remaining locked during processing for as long as I can remember. Deleting related variables has only ever worked for shapefiles, not feature classes within a geodatabase. ESRI should definitely provide users with more control over these lock files with some kind of toggleable, use-at-your-own-risk type of setting.&lt;/P&gt;&lt;P&gt;That said, there is a work-around. With some clever coding you can terminate the active script (which releases the locks) and restart it where you left off by using the subprocess module and a system variable.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import sys
import subprocess

def task1():
	print('--begin task 1')
	
def task2():
	print('--begin task 2')

if len(sys.argv) &amp;gt; 1 and sys.argv[1] == "task1complete":
    task2()
    print('--script finished')
else:
    print('--begin script')
    task1()
    subprocess.Popen([sys.executable] + sys.argv + ["task1complete"], close_fds=True) # relaunch the script
    sys.exit() # ensure the original script closes and locks release&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 21:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1595436#M93985</guid>
      <dc:creator>Josh-R</dc:creator>
      <dc:date>2025-03-13T21:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1597009#M94140</link>
      <description>&lt;P&gt;One way is to do all of your work in a subprocess call.&amp;nbsp; When the subprocess exits, the process will be destroyed and locks will be gone.&amp;nbsp; Another thing you can try is import gc (python's garbage collection module), then call gc.collect().&amp;nbsp; Python may not be cleaning up the objects even after you've deleted them.&amp;nbsp; This method doesn't guarantee that it will clean up all objects though.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 12:21:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1597009#M94140</guid>
      <dc:creator>DavidTillberg_community</dc:creator>
      <dc:date>2025-03-19T12:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1615140#M95802</link>
      <description>&lt;P&gt;Hello Robert.&amp;nbsp; Your response on this post caught my attention.&amp;nbsp; Please see my related post from 05-14-2025, entitled &lt;A href="https://community.esri.com/t5/arcgis-pro-questions/map-automation-seeking-scripting-solution-for/m-p/1614849#M95783" target="_self"&gt;Map Automation - Seeking Scripting Solution for Opening an APRX from Python IDLE&lt;/A&gt;.&amp;nbsp; For my particular project, I would challenge the notion that the "&lt;SPAN&gt;method has little value when run in a script outside of the application&lt;/SPAN&gt;".&amp;nbsp; Maybe what I'm trying to do is somewhat obscure or uncommon, but for my organization it certainly does have value.&amp;nbsp; Regardless, I greatly appreciate your response on 03-20-2024.&amp;nbsp; It provides valuable insight regarding the issue I've encountered.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 18:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1615140#M95802</guid>
      <dc:creator>CMorneau</dc:creator>
      <dc:date>2025-05-15T18:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1615164#M95805</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/450062"&gt;@CMorneau&lt;/a&gt;&amp;nbsp;- the statement is my response was attributed to the&amp;nbsp;"&lt;SPAN&gt;ENH-000140298 -&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Add a method to the arcpy.mp.ArcGISProject() object that will close the project and release locks held by a script" request I found within the "internals" and is not a statement that I would make.&amp;nbsp; Apologies if it came across that way as that was not my intent.&amp;nbsp; Please let me know if there's anything I may assist you with!&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 19:33:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1615164#M95805</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2025-05-15T19:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mp.ArcGISProject .aprx lock issue</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1616075#M95871</link>
      <description>&lt;P&gt;Hello Robert.&amp;nbsp; No apologies needed.&amp;nbsp; I was not offended in anyway.&amp;nbsp; Again, I greatly appreciate the insight provided in your 03-20-2024 post.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 18:52:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-mp-arcgisproject-aprx-lock-issue/m-p/1616075#M95871</guid>
      <dc:creator>CMorneau</dc:creator>
      <dc:date>2025-05-20T18:52:02Z</dc:date>
    </item>
  </channel>
</rss>

