I would like to update the data source of a specific layer in multiple map documents using ArcPy, however I'm getting a <type 'exceptions.SyntaxError'>: invalid syntax error on this line:
if lyr.datasetName == inputlayer
import arcpy, string, os
import arcpy.mapping as MAP
try:
MXDList = string.split(arcpy.GetParameterAsText(0), ";") #ArcMap document(s)
inputlayer = arcpy.GetParameterAsText(1) # featureclass
newwork = arcpy.GetParameterAsText(2) # Workspace
for MXDPath in MXDList:
MXD = MAP.MapDocument(MXDPath)
for dataframe in arcpy.mapping.ListDataFrames(MXD):
lyrs = arcpy.mapping.ListLayers(dataframe)
for lyr in lyrs:
if lyr.datasetName == inputlayer
lyr.replaceDataSource(newwork, "FILEGDB_WORKSPACE", "Center")
MXD.save()
I must be missing something obvious here? I was attempting to reference this forum thread.
Thank You

MXD.save()should be indented an additional 4 spaces but it won't let me make the edit. – blah238 Oct 13 '11 at 21:37