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?