More often than not, python seems to be locking up my aprx after executing scripts. Opening ArcGIS Pro following script execution results in a schema lock. My script deletes the aprx as recommended but is there something else I need to do. Typically, I have not been saving the aprx so the aprx.save() is usually omitted. The scripts are ran outside of ArcGIS Pro in a standalone Jupyter Notebook environment.
The following snippet is recommended in the documentation:
aprx = arcpy.mp.ArcGISProject(<PATH>)
mp = aprx.listMaps(<MAP NAME>)[0]
<DO SOMETHING>
aprx.save()
del aprx
I'm wondering if the following context manager would work better, but am not seeing anything in the documentation.
with arcpy.mp.ArcGISProject(<PATH>) as aprx:
mp = aprx.listMaps(<MAP NAME>)[0]
<DO SOMETHING>
aprx.save()
Thank you,
Tyler