AnsweredAssumed Answered

Why does this Arcpy Script Execute - but Fail to Accomplish Objective

Question asked by jlabate on Apr 29, 2015
Latest reply on Apr 29, 2015 by Dan_Patterson


I'm trying to simply change the workspace paths for a folder full of mxds at a time.I came across this script which executes in the Python Window of Arcmaap without an error message being thrown. Unfortunately, when I open an mxd in the folder to check results nothing has changed - it still points to the old workspace.


The workspace I am trying to have the Arcpy script repoint to is an SDE Workspace being served by Sequal Server Express. I read that there are "known issues" with SSExpress. Am I doomed?


Other Arcpy attempts to just swap the workspaces of a single mxd - also repointing to SDE have had some success - if "saveACopy"


Any assistance is appreciated. Here's the script that doesn't error out or accomplish the task either. Thanks in advance - Jim


import arcpy, os

>>> folderPath = r"G:\Projects\Utilities"

>>> 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)

...             mxd.findAndReplaceWorkspacePaths(r"N:\SDE_Backup_2014\Shapefiles.gdb", r"Database Connections\Connection to usmasvgdpw01.sde")