AnsweredAssumed Answered

arcpy.replaceDataSource woes...

Question asked by KevinBellSLC on Jul 13, 2012
Latest reply on Jul 13, 2012 by KevinBellSLC
I'm trying to replace the datasource from a file gdb to a shapefile, but I can't get it to go...  what am I doing wrong here?!

import arcpy mxd = arcpy.mapping.MapDocument(r"N:\000_mapServices\forestry\forestryVulnerabilityByArea93Copy.mxd") for lyr in arcpy.mapping.ListLayers(mxd):     print     if lyr.isGroupLayer:         pass     else:         if lyr.supports("DATASOURCE"):             print 'yes'             print lyr.dataSource                          if lyr.dataSource == r"N:\000_mapServices\forestry\Forestry.gdb\trees_102100":                 print 'it is----------------------'                 lyr.replaceDataSource(r"N:\000_mapServices\forestry",  'SHAPEFILE_WORKSPACE', 'trees.shp')                              mxd.saveACopy(r"N:\000_mapServices\forestry\forestryVulnerabilityByArea2.mxd") del mxd