Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

mxd.saveACopy changes layout to portrait

$
0
0
I have developed a script that loops through all MXDs in a given directory, stores relative paths and then saves it as ArcGIS 9.x compatible.

At firts I thought it was working as expected. But I just opened one of the copied MXDs and it has reset the page layout to portrait 8.5 x 11. The original file was landscape 13 x 8.5.

Any idea why it did this and how I could modify the code to insure that the layout information is preserved in the resulting copy?

Here is my code:

Code:


import arcpy, os
def prinnames(sPath):
        folderPath = sPath
            for filename in os.listdir(folderPath):
                fullpath = os.path.join(folderPath, filename)
                if os.path.isfile(fullpath):
                        basename, extension = os.path.splitext(fullpath)
                        if extension.lower() == ".mxd":
                                mxd = arcpy.mapping.MapDocument(fullpath)
                                print(basename + "v9")
                                mxd.relativePaths = 'True'
                                mxd.saveACopy(basename + "v9.mxd","9.0")
                else:
                       
                        prinnames(fullpath)

prinnames('C:\Gareth\cityWork\CAPERMaps')


Viewing all articles
Browse latest Browse all 2485

Trending Articles