Hi, I am trying to change the data source of our parcel fabric that is not being maintained to a new one stored in the same SDE dataset. I have created a script to the best of my ability and I get this error. I have searched for possible solutions all day. I am sure it's a simple solution but this is time sensitive and I need to figure out what I am doing wrong as soon as possible. Thanks for any help you can offer.
ERROR:
if lyr.name == "Fernie Parcel":
NameError: name 'lyr' is not defined
---------------------------------------------------------------------------------------------------------------------------------------
import arcpy
from arcpy import env
from arcpy import mapping
arcpy.env.workspace = workspace = r"P:\mxd_data_source"
arcpy.env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd = workspace + "\\" + mxd
print mxd + " is being processed"
mxd = arcpy.mapping.MapDocument(mxd)
for df in arcpy.mapping.ListDataFrames(mxd, "*"):
if lyr.name == "Fernie Parcel":
lyr.replaceDataSource(workspace, "SDE_WORKSPACE", "parcel_pmbc", validate=True)
print "Successfully updated data sources"
mxd.save()