Hi. I have python code extension that runs on startup. The MXD has "store relative Paths" turned on by default. The script works well and does what it has to do. However every time the script runs it stops the ""Store relative paths" in the MXD from working and breaks the link to the local gdb. The script simply resources some of the layers in the MXD to the new SDE database. So not sure why its interfering with the "Store relative paths" for the local gdb. If i remove the extension and my code is not running then Store relative paths work. I have made sure the data folder and MXD are in same location. I have inserted MXD.relativepaths = True but the script ignores it. I have checked the MXD properties when the script runs and there is a tick in the box so not sure if this is a bug in ArcMap? Any ideas? import arcpy import pythonaddins class ExtensionClass1 ( object ) : """Implementation for python_addin.extension2 (Extension)""" def __init__ ( self ) : # For performance considerations, please remove all unused methods in this class. self . enabled = True def startup ( self ) : mxd = arcpy . mapping . MapDocument ( "CURRENT" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE1.sde" , r "C:\ArcGIS_10.3.1\SDE1.sde" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE2.sde" , r "C:\ArcGIS_10.3.1\SDE2.sde" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE3.sde" , r "C:\ArcGIS_10.3.1\SDE3.sde" ) arcpy . RefreshActiveView ( ) arcpy . RefreshTOC ( ) mxd . relativepaths = True def openDocument ( self ) : mxd = arcpy . mapping . MapDocument ( "CURRENT" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE1.sde" , r "C:\ArcGIS_10.3.1\SDE1.sde" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE2.sde" , r "C:\ArcGIS_10.3.1\SDE2.sde" ) mxd . findAndReplaceWorkspacePaths ( r "C:\ArcGIS\SDE3.sde" , r "C:\ArcGIS_10.3.1\SDE3.sde" ) arcpy . RefreshActiveView ( ) arcpy . RefreshTOC ( ) mxd . relativepaths = True
... View more