replaceDataSource OR findAndReplaceWorkspacePath for CAD files

Discussion created by DrColgate on Dec 28, 2011
Latest reply on Feb 4, 2013 by jbarrette-esristaff
I've been trying to update the links to CAD that have had their name changed and have been moved to a different location but have had no changes made to the data itself.

Essentially the Original Path and the New Path are taken from an existing List and the data is updated as either:

layer.replaceDataSource(unicode(DATA_PATH), FILE_TYPE, unicode(FILE_NAME))


layer.findAndReplaceWorkspacePath(unicode(PREV_PATH), unicode(DATA_PATH))

Either way I get the same error:

<type 'exceptions.ValueError'>: Layer: Unexpected error
Failed to execute (BatchMxdDataSourceUpdate).

Where "BatchMxdDataSourceUpdate" is the routine that I am running to update that MXD data sources.

I am using the same code to loop through and update from SHP to GDB, GDB to GDB and also replacing Raster so I am not sure why it is not working for CAD files.  Each has a different handler but is essentially the same syntax.  In this case the CAD files are DXF but I have other instances of DWG that will also need to be updated in the future.