AnsweredAssumed Answered

I'm getting an 'unexpected error' in, line 696

Question asked by bradenwyatt on Feb 22, 2018
Latest reply on Feb 22, 2018 by bradenwyatt

I'm trying to use the findAndReplaceWorkspacePath function and I'm getting an error in the & modules.


Here's the line from 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