Runtime error <type 'exceptions.IndexError'>: list index out of range

Discussion created by Sycosys on Jun 5, 2012
Latest reply on Jun 5, 2012 by Sycosys
my List indices are 0 and 1 those are the only two..

Can anyone help spot what's causing that?

import arcpy
from arcpy import env

arcpy.env.overwriteOutput = True

#set working MDB Here

arcpy.env.workspace = "C:/Users/atimpson/Desktop/Brunswick/PowerPlant.mdb/BPDMLayers"
dataList = arcpy.ListFeatureClasses()

mxd = arcpy.mapping.MapDocument("CURRENT")
lyrlist = arcpy.mapping.ListLayers(mxd)

# Reads a base table and outputs Feature Class and Layer Lists

readTable = open("C:/Users/atimpson/Desktop/ScriptTable/BPWorksLayers.csv")

# Figure out position of feature class and layer in the header
headerLine = readTable.readline()
valueList = headerLine.split(",")

fcPos = valueList.index("Feature Class")
lyrPos = valueList.index("Layers")

# Read lines in the file and append to comparison lists
baseFeature = []
baseLayer = []

for line in readTable.readlines():
 segmentedLine = line.split(",")

#Performs comparisons between project data/layers and idealized data/layers

if "BPWorks 2 Layers" in     

 for lyr, base in zip(lyrList, baseLayer):
  if lyr != base:
   print(lyr, "is different from", base)