'file path here' Object: CreateObject Layer invalid data source 'file path here' Object: CreateObject Layer invalid data source filePathHere Added: FilePath.lyr
try: if countyLayers[0]: for item in countyLayers.split(';'): try: item1=arcpy.mapping.Layer(item) arcpy.mapping.AddLayer(dataFrame,item1,"AUTO_ARRANGE") item2=str(item.split("\\")[-1]) arcpy.AddMessage("Added: " + item2) arcpy.RefreshTOC() del item1, item2 except Exception as e: arcpy.AddMessage(e.message) pass except: arcpy.AddMessage("No county data specified to add") pass
Solved! Go to Solution.
arcpy.mapping.AddLayer(dataFrame,Layer.strip("'"),"AUTO_ARRANGE")
arcpy.mapping.AddLayer(dataFrame,Layer.strip("'"),"AUTO_ARRANGE")