Neftex

Help with repairing data source

Discussion created by Neftex on Jun 20, 2011
Latest reply on Jun 24, 2011 by jbarrette-esristaff
Hi,

I have been trying to get this code to work for the last couple of hours, if anyone could give me some help that would be great.

I would like to repoint any broken links to a new table that lies within a personal geodatabase. The code I have is:

import arcpy, os
path = r"N:\Temporary_Work\Oliver Morris\EDCOLLINS_ISOPACH"
for fileName in os.listdir(path):
    fullPath = os.path.join(path, fileName)
    if os.path.isfile(fullPath):
        basename, extension = os.path.splitext(fullPath)
        if extension == ".mxd":
            mxd = arcpy.mapping.MapDocument(fullPath)
            print "MXD: " + fileName
            brknList = arcpy.mapping.ListBrokenDataSources(mxd)
            for brknItem in brknList:
                 lyr.replaceDataSource (r" N:\Temporary_Work\mapping_2011.mdb",        "ACCESS_WORKSPACE", SEA_110617)
                 print "\t" + brknItem.name
del mxd


When I run this I get the error - Runtime error <type 'exceptions.NameError'>: name 'SEA_110617' is not defined

Can you please point me in the right directions.

Thanks,

Oliver

Outcomes