AnsweredAssumed Answered

arcpy.mapping.MapDocument bug

Question asked by cyrillem on Jun 18, 2012
Latest reply on Jun 28, 2012 by cyrillem
The MapDocument Syntax clearly states that the first input is:
"A string that includes the full path and file name of an existing map document (.mxd) or a string that contains the keyword CURRENT"

The bug is that arcpy.mapping.MapDocument() happily accepts a partial/relative path yet only provides limited functionality. The arcpy.mapping.MapDocument object will fail depending on the method called. The errors messages of the methods do not refer to the cause.

A simple example
import arcpy  arcpy.env.workspace = "c:/arcgis/"  # Using a relative path mxd = arcpy.mapping.MapDocument('maps/template.mxd')  #works  #fails -> "AttributeError: MapDocObject: Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document." mxd.saveACopy('template_copy.mxd')

When providing a full path to the MapDocument class no error is encountered when calling the saveACopy() method.

The existing saveACopy() error is red herring. Upon receiving a relative path the MapDocument class should return an error.