I'm trying to use the findAndReplaceWorkspacePath function and I'm getting an error in the utils.py & _mapping.py modules.
Here's the line from _mapping.py w the error (696) return convertArcObjectToPythonObject(self._arc_object.findAndReplaceWorkspacePath(*gp_fixargs((find_workspace_path, replace_workspace_path, validate), True)))
I'm using PyScripter3.2.2.0, Windows 7, ArcGIS 10.4.1. I just tried updating to the newest version of Python and that didn't do anything; same error.
My code is very basic. I'm a python beginner, looking to update a series of .lyr files. I'm working off of code from someone else that initially pulled in .lyr file paths from a text file, but I scaled it back to test on a single .lyr file first.
import sys, string, os, arcpy
new_wp = r" < new path > "
layer_file = r" < file path > "
lyrFile = arcpy.mapping.Layer(layer_file)
old_wp = lyrFile.workspacePath
lyrFile.findAndReplaceWorkspacePath(old_wp,new_wp)
lyrFile.save()