title: Python: TypeError: 'NoneType' object is not iterable
body: <p>I am attempting to use the following function to simulate loads on a beam:</p>
  
  <pre><code>def simulateBeamRun(personList, beam, times):
  </code></pre>
  
  <p>I have come up with the following code so far:</p>
  
  <pre><code>def createPersonList(fileName):
      """Function will go through each line of file and
      create a person object using the data provided in
      the line and add it to a list
      """
      theFile = open(fileName)
      next(theFile)
      #array = []
      for line in theFile:
          aList = line.split(',')
          bList = map(lambda s: s.strip('\n'), aList)
          cList = [float(i) for i in bList]
          print cList
  
  def simulateBeamRun(personList, beam, times):
      """Takes a list of times covering the duration of
      the simulation (0-35 s), the list of person
      objects and a beam object to simulate a beam run
      """
      dList = []
      for time in times:
          eList = []
          for person in personList:
              loadTuples = personModel.person.loadDisplacement(time)
              if beamModel.beam.L &gt; loadTuples[1] &gt; 0:
                   eList.append(loadTuples)
              else:
                  return None
          beamModel.beam.setLoads(eList)
          dList.append(beamModel.beam.getMaxDeflection())
  </code></pre>
  
  <p>However, I am getting the following error when trying to run the function (before I give it any inputs:</p>
  
  <pre><code>for person in personList:
  TypeError: 'NoneType' object is not iterable
  </code></pre>