mimiller

Find and Replace Workspace Path not working

Discussion created by mimiller on Jun 21, 2012
Latest reply on Jun 25, 2012 by mimiller
Attempting to use the find and replace workspace path, but it's returning an error message. Any suggestions on why it's not working?

import arcpy
import os

ckFolder = r"\\itdhq1apt50\gis_data\testUpdatePaths\FremontCounty"
arcpy.env.workspace = ckFolder
print "Checking Folder: " + ckFolder
arcpy.AddMessage("Checking Folder: " + ckFolder)

for mDoc in arcpy.ListFiles("*.mxd"):
    mxd = os.path.join(ckFolder, mDoc)
    #print fullpath
    #mxd = arcpy.mapping.MapDocument(ckFolder + os.sep + mDoc)
    arcpy.AddMessage("MXD Name: " + mxd)
    mxd.findAndReplaceWorkspacePaths(r"J:\GIS\JHill\SDE_To_Route", r"\\itdgishq\hqgis\LocalRds\SDE_To_Route", "FALSE")
    mxd.save()



Traceback (most recent call last):
  File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
    exec codeObject in __main__.__dict__
  File "\\Itdgishq\hqgis\updateDataPaths.py", line 25, in <module>
    mxd.findAndReplaceWorkspacePaths(r"J:\GIS\JHill\SDE_To_Route", r"\\itdgishq\hqgis\LocalRds\SDE_To_Route", "FALSE")
AttributeError: 'unicode' object has no attribute 'findAndReplaceWorkspacePaths'

Outcomes