I have a script that looks through datasets in a geodatabase and copies a mxd document to a folder. The programs works, however it is saving the map documents to my desktop and not the specified folder on my desktop (PATH2). This is the code I have so far:
import arcpy
import os
PATH1 = r"C:\Users\Daimon Nurse\Desktop\DFMPROJECT\DFM.gdb"
PATH2 = r"C:\Users\Daimon Nurse\Desktop\DFMPROJECT\"
arcpy.env.workspace = PATH1
arcpy.env.overwriteOutput=True
zones = arcpy.ListDatasets("Zone*")
for zone in zones:
mxd = arcpy.mapping.MapDocument(r"C:\Users\Daimon Nurse\Desktop\DFMPROJECT\Complete Final Capstone Map\Complete Z2 Campus Map_Landscape1.mxd")
print zone
mxd.saveACopy(PATH2 + zone)
Answer
I would set the PATH2 variable this way:
PATH2 = r"C:\Users\Daimon Nurse\Desktop\DFMPROJECT"
And then try this insead of mxd.saveACopy(PATH2 + zone)
:
newmxd = os.path.join (PATH2, zone + ".mxd")
mxd.saveACopy(newmxd)
No comments:
Post a Comment