replaceDataSource Not Working

Discussion created by john.stephens on Apr 2, 2012
Latest reply on Apr 3, 2012 by john.stephens
So I have a map with a bunch of ASC files that have been updated and I need to relink them all.  I am trying to use replaceDataSource, but it just links all the files to the first ASC file in the folder.

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd, "SSPA_RIFS_Alt*"):
    if lyr.supports("DATASOURCE"):
        lyr.replaceDataSource(r"C:\Folder", "NONE", file_name)
del mxd

Ignore "file_name" but it's a variable I've set to collect the right name for each ASC based on the layer name in the map.  (it works, I've checked it with print messages).

I've also tried using "RASTER_WORKSPACE" instead of "NONE" for the workspace type, but I get the same results.

Any ideas?