Update\change features data source.

Discussion created by Tonyalmeida on Jan 28, 2014
Latest reply on Jan 29, 2014 by Tonyalmeida
I have some layers that i need to change the data source for.

The current script i have gives me the following error. I don't know why.
if anyone would be kind to help me out please?

import arcpy
from arcpy import env
from arcpy import mapping

workspace = arcpy.env.workspace =  "C:/GIS/MAPBOOK/Proposed Zoning Book"

arcpy.env.overwriteOutput = True

mxdList = arcpy.ListFiles("*.mxd")

for mxd in mxdList:
    mxd = workspace + "//" + mxd
    for lyr in arcpy.mapping.ListLayers(mxd): 
        if == "PROPOSED ZONING":
                lyr.replaceDataSource("C:/Users/t***a/AppData/Roaming/ESRI/Desktop10.1/ArcCatalog/DSD15_SQLEXPRESS.gds/DSD/DSD.DBO.MUNICIPALITY", "SHAPEFILE_WORKSPACE", "DSD.DBO.FUTURE_LAND_USE_ZONING")
    for lyr in arcpy.mapping.ListLayers(mxd): 
        if == "CITY LIMITS":
                lyr.replaceDataSource("C:/Users/t***a/AppData/Roaming/ESRI/Desktop10.1/ArcCatalog/DSD15_SQLEXPRESS.gds/TonyOneWay/TonyOneWay.DBO.Canyon_Features", "SHAPEFILE_WORKSPACE", "TonyOneWay.DBO.City_Limits")            
    print "Successfully updated data sources"

Traceback (most recent call last):
  File "C:\GIS\Python Scripts\Change Data Source MXD", line 13, in <module>
    for lyr in arcpy.mapping.ListLayers(mxd):
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\", line 181, in fn_
    return fn(*args, **kw)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\", line 1500, in ListLayers
    result = mixins.MapDocumentMixin(map_document_or_layer).listLayers(wildcard, data_frame)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 823, in listLayers
    layers = self.layers
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 683, in layers
    for frame in reversed(self.dataFrames):
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 695, in dataFrames
    return map(convertArcObjectToPythonObject, self.pageLayout.dataFrames)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 679, in pageLayout
    return convertArcObjectToPythonObject(self._mxd._arc_object.pageLayout)
AttributeError: 'unicode' object has no attribute '_arc_object'