Select to view content in your preferred language

ArcGIS Pro 3.1 Locking APRX Project files

471
0
04-12-2023 03:21 PM
SteveRichards1
New Contributor II

I am running into a bit of a problem with the way that ArcGIS Pro 3.1 locks the APRX files when scripts access them using arcpy modules. The process that was developed in 2.X makes a copy of a blank project (because you can’t create a new project using arcpy) that is pasted into a temporary location. The script then adds in the .pagx files that are used as a map/layout template for the generated maps. In 2.X, after the maps are made using arcpy, the script cleans up those temporary APRX files by using os.remove(). However, in 3.1, the temp APRX file remains locked until you close down the APRX file that you ran the script from, causing the files to build up in the temp location. Some things I have tried so far:

  1. Changed os.remove() to arcpy.Delete_management() the error went from: ‘Could not delete the APRX file: [WinError 32] The process cannot access the file because it is being used by another process’ to ‘000601: Cannot delete <value>. May be locked by another application.
  2. Created a new project file from ArcGIS Pro 3.1 to act as the import template project
  3. Created new .pagx files in 3.1 for importing the status and overview maps
  4. Adjusted where the code executes the delete function to see if it was locked for a short time after map-making, but the project is locked until I close the project where the script is ran from.

Other details:

1. ArcGIS Pro install is on a Windows 2016 Server

2. The write location of the APRX files is in a location on the server that gets cleaned up after the user signs out of the server. This location did not cause an issue with ArcGIS  Pro 2.X

Thank-you in advance for any help or assistance!

0 Replies