Hello,
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")
... mxd.save()
Solved! Go to Solution.
From the help files
Would this not be your scenario?
MapDocument.replaceWorkspaces(old_workspace_path, old_workspace_type, new_workspace_path, new_workspace_type, {validate})
From the help files
Would this not be your scenario?
MapDocument.replaceWorkspaces(old_workspace_path, old_workspace_type, new_workspace_path, new_workspace_type, {validate})
Thanks Dan,
That method did work - strange side effect though - the mxds page size defaulted to leter when they were all originally 11X17. Anything in the code causing that?
Thanks again,
Jim
maybe it uses a default template during the transition, if so, I suppose you can set it somewhere before running the script