I am setting up a file to format a map template. I am stuck at the Add Layer section. I have a dictionary which is layer name:layer path. I want to grab all the layer paths and add them as layers to the map template. How can I fix my code?TemplateLayers=(r"\\...\TemplateLayers.txt")
lyrDict={}
with open (TemplateLayers) as f:
for line in f:
(key,val)=line.split(",")
lyrDict[(key)]=val
f.close()
print lyrDict
#Step 2: Pull the layers into the MXD at the bottom of the data frame from the dictionary.
for val in lyrDict.values():
arcpy.mapping.AddLayer("",(val),"Bottom")
I get: Runtime error <type 'exceptions.AssertionError'>:When I print my dictionary it looks like this:{'Roads':'\\\\filepath\\filename.lyr',etc....}