title: IndexError: list index out of range'
body: <p>I'm writing a code using python to generate a point shapefile within ArcMAP. I have a 1000 random possibilities of 50 points (in FileA (1000:50), and I need to try all of them. </p>
  
  <p>Coordinates X of each point = FileB(:,1). Coordinates Y of each point = FileB(:,2).</p>
  
  <p>to generate a sequence, i'm taking the first row of FileA, and the number in FileA(1,1) corresponds to the position in the new sequence of the point 1 in FileB</p>
  
  <p>I'm trying to create a loop in which I create these sequences following the position in each row of FileA.</p>
  
  <p>I have a previous post:
  <a href="https://stackoverflow.com/questions/9335738/attributeerror-str-object-has-no-attribute-tointeger">AttributeError: &#39;str&#39; object has no attribute &#39;toInteger&#39;</a></p>
  
  <p>I changed the 'entry.toInteger()[0]' to 'int(entry[])'. Mixing languages... </p>
  
  <p>I have this new error: </p>
  
  <pre><code>'tempXYFile.writerow('{0},{1}'.format(coordinates[int(entry)][0],coordinates[int(‌​entry)][1])) IndexError: list index out of range' 
  </code></pre>
  
  <p>I'll appreciate any help !</p>
  
  <p>This is my code:</p>
  
  <pre><code>import csv
  
  # create 1000 XY sequences
  print 'Start of the script'
  sequences = csv.reader(open('50VolcanoPaleoOrder-11-01-2012.csv','rb'),delimiter=',')
  coordinates = []
  
  # read coordinates of volcanos and store in memory
  print 'Start reading in the coordinates into the memory'
  coordinates_file = csv.reader(open('seq50.csv','rb'),delimiter=',')   
  
  for coordinate in coordinates[1:]:
      coordinates.append(coordinate)
  del coordinates_file
  
  i = 1
  for sequence in sequences:
      print 'sequence # {0}'.format(i) 
      j = 1           
      tempXYFile = csv.writer(open('tempXY.csv','w+'),delimiter=',') #add the parameter to create a file if does not exist                  
      for entry in sequence:         
          tempXYFile.writerow('{0},{1}'.format(coordinates[int(entry)][0],coordinates[int(entry)][1]))
          print 'Entry # {0}: {1},{2}'.format(j, coordinates[int(entry)][0],coordinates[int(entry)][1]) 
          j = j + 1
      i = i + 1
      del tempXYFile
  
  print 'End of Script'
  </code></pre>