I have a script, where I prepare the maps and then save a copy to do some finetuning which would be to complicated for scripting. During the export the paths get destroyed. I use shapefiles because it is the easiest format to access from R or excel.
Project file: Drive\somepath \project_folder\map_path\mapx.aprx
Some data in the map: Drive\somepath \project_folder\report_path\some_data.shp or
Drive\somepath \project_folder\map_path\more_data.shp
Home location: Drive\somepath \project_folder
New location: Drive\somepath\project_folder\report_path\mapy.aprx
Saving a copy manually works, when saving in python with aprx.saveACopy() the paths get totally messed up:
e.g. the data becomes: Drive\somepath \report_path\some_data.shp or Drive\somepath \map_path\more_data.shp, i.e. the project_folder got removed from the path.
Data outside the project can also get some weird path, adding \somepath in front of the original path:
Data from Drive\otherpath \other_data.shp becomes Drive\somepath\otherpath \other_data.shp
Anybody else who has experienced this? Is there a way to avoid this?
From ArcGISProject—ArcGIS Pro | Documentation
saveACopy is supposed to....
The method creates a new output project file, but the project variable continues to reference the original ArcGISProject object. It does not duplicate all the content within a project folder.
@DanPattersonExactly, I expect it to refer to exactly the same data as in the original aprx, which it doesn't. And that is exactly the problem. It invents path-combinations that do not exist. Manually saving a Copy keeps tha paths correctly.
Nothing in the current list of bugs
you should contact Tech Support
I have opened a support case. In the meantime I have observed that it does not happen consistently but is probably related to having used several instances of ArcGIS Pro open. Still, since the paths are shown as absolute paths, I expect them to behave as such. I will update, when the support comes back.
It has now bug number BUG-000160540