<?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 Running external python script locks .aprx file to read only in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/running-external-python-script-locks-aprx-file-to/m-p/1350712#M69253</link>
    <description>&lt;P&gt;Hi, I am making a script to run through a folder and find all the aprx files and update the transformations used for the maps within them. For the most part this is working however, the last aprx is modifies is often locked to readonly. It alternates each time it is run to either lock the aprx or not.&lt;/P&gt;&lt;P&gt;This is the script:&lt;/P&gt;&lt;P&gt;import os, arcpy&lt;/P&gt;&lt;P&gt;GISserver = r'C:\Users\user\Documents\Backup\C161946'&lt;/P&gt;&lt;P&gt;for root, dirs, files in os.walk(GISserver):&lt;BR /&gt;&amp;nbsp;for file in files:&lt;BR /&gt;&amp;nbsp; if file.endswith(".aprx"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;try:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; aprx = arcpy.mp.ArcGISProject(os.path.join(root, file))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print(os.path.join(root, file))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for m in aprx.listMaps():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.name)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.transformations)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;TransformationDictionary = {'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;m.updateTransformations(TransformationDictionary)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.transformations)&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; print(aprx.isReadOnly)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; aprx.save()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; print(aprx.isReadOnly)&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;except:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print("Couldn't update transformations in " + os.path.join(root, file))&lt;/P&gt;&lt;P&gt;del aprx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log it creates is:&lt;/P&gt;&lt;P&gt;runfile('C:/Users/user/Documents/Tool_Test_Project/Scripts/TransformationModifierTest.py', wdir='C:/Users/user/Documents/Tool_Test_Project/Scripts')&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946 - Copy.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;runfile('C:/Users/user/Documents/Tool_Test_Project/Scripts/TransformationModifierTest.py', wdir='C:/Users/user/Documents/Tool_Test_Project/Scripts')&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946 - Copy.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;True&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Couldn't update transformations in C:\Users\user&lt;SPAN&gt;\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So as you can see this is from running the script twice the first time both projects are saved correctly but the second one was read only when manually opened. The second time through the second project failed to save because it was read only but was fine when opened afterwards. Does anybody know what is going on here and how to fix it?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Nov 2023 14:02:31 GMT</pubDate>
    <dc:creator>AmosWall</dc:creator>
    <dc:date>2023-11-17T14:02:31Z</dc:date>
    <item>
      <title>Running external python script locks .aprx file to read only</title>
      <link>https://community.esri.com/t5/python-questions/running-external-python-script-locks-aprx-file-to/m-p/1350712#M69253</link>
      <description>&lt;P&gt;Hi, I am making a script to run through a folder and find all the aprx files and update the transformations used for the maps within them. For the most part this is working however, the last aprx is modifies is often locked to readonly. It alternates each time it is run to either lock the aprx or not.&lt;/P&gt;&lt;P&gt;This is the script:&lt;/P&gt;&lt;P&gt;import os, arcpy&lt;/P&gt;&lt;P&gt;GISserver = r'C:\Users\user\Documents\Backup\C161946'&lt;/P&gt;&lt;P&gt;for root, dirs, files in os.walk(GISserver):&lt;BR /&gt;&amp;nbsp;for file in files:&lt;BR /&gt;&amp;nbsp; if file.endswith(".aprx"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;try:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; aprx = arcpy.mp.ArcGISProject(os.path.join(root, file))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; print(os.path.join(root, file))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for m in aprx.listMaps():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.name)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.transformations)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;TransformationDictionary = {'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;m.updateTransformations(TransformationDictionary)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print(m.transformations)&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; print(aprx.isReadOnly)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; aprx.save()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp; print(aprx.isReadOnly)&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;except:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print("Couldn't update transformations in " + os.path.join(root, file))&lt;/P&gt;&lt;P&gt;del aprx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log it creates is:&lt;/P&gt;&lt;P&gt;runfile('C:/Users/user/Documents/Tool_Test_Project/Scripts/TransformationModifierTest.py', wdir='C:/Users/user/Documents/Tool_Test_Project/Scripts')&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946 - Copy.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;runfile('C:/Users/user/Documents/Tool_Test_Project/Scripts/TransformationModifierTest.py', wdir='C:/Users/user/Documents/Tool_Test_Project/Scripts')&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946 - Copy.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;False&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;C:\Users\user\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;BR /&gt;C161946-01-01-Overlay&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-01-01&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;C161946-AGOL&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers1&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;Layers11&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;{'2D': ['WGS_1984_To_OSGB_1936_OSTN15'], '3D': []}&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;True&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Couldn't update transformations in C:\Users\user&lt;SPAN&gt;\Documents\Backup\C161946_ArcGIS_Pro\C161946.aprx&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So as you can see this is from running the script twice the first time both projects are saved correctly but the second one was read only when manually opened. The second time through the second project failed to save because it was read only but was fine when opened afterwards. Does anybody know what is going on here and how to fix it?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 14:02:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-external-python-script-locks-aprx-file-to/m-p/1350712#M69253</guid>
      <dc:creator>AmosWall</dc:creator>
      <dc:date>2023-11-17T14:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Running external python script locks .aprx file to read only</title>
      <link>https://community.esri.com/t5/python-questions/running-external-python-script-locks-aprx-file-to/m-p/1351259#M69258</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/669809"&gt;@AmosWall&lt;/a&gt;;&amp;nbsp;I run into this all the time working in stand alone notebooks.&amp;nbsp; The 'del aprx' runs successfully, but upon opening ArcGIS Pro (or another script like you have done) the project is still locked.&amp;nbsp; The only work around I have found is to kill the kernel to release the lock.&amp;nbsp; Reference&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/python-causing-schema-lock-on-aprx/m-p/1132522" target="_blank"&gt;https://community.esri.com/t5/python-questions/python-causing-schema-lock-on-aprx/m-p/1132522&lt;/A&gt;&amp;nbsp;my post on the matter.&lt;BR /&gt;&lt;BR /&gt;Tyler&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Nov 2023 15:18:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-external-python-script-locks-aprx-file-to/m-p/1351259#M69258</guid>
      <dc:creator>TylerT</dc:creator>
      <dc:date>2023-11-19T15:18:01Z</dc:date>
    </item>
  </channel>
</rss>

