title: "TypeError: 'NoneType' object is not iterable" on what should be a list
body: <p>I've got some code that I based off of what I found <a href="https://stackoverflow.com/questions/14438928/python-zip-a-sub-folder-and-not-the-entire-folder-path">here</a>, but because of my low reputation I can't comment to ask a question. I've also looked through all other posts related to this same error, but, probably due with my lack of familiarity with programming and Python, I haven't found a solution.</p>
  
  <p>Right, so I've got the following code:</p>
  
  <pre><code>import zipfile, os
  
  def dirEntries(dir_name):
      ''' Creates a list of all files in the folder 'dir_name' which we assign when we call the function later'''
  
      fileList = []
      '''creates an empty list'''
      for file in os.listdir(dir_name):
          '''for all files in the directory given'''
          dirfile = os.path.join(dir_name, file)
          '''creates a full file name including path for each file in the directory'''
          if os.path.isfile(dirfile) and os.path.splitext(dirfile)[1][1:]!='lock':
              '''if the full file name above is a file and it does not end in 'lock' it will be added to the list created above'''
              fileList.append(dirfile)
  
  def makeArchive(fileList, archive, root):
      """
      'fileList' will be a list of file names - full path each name
      'archive' will be the file name for the archive with a full path (ex. "C:\\GIS_Data\\folder.zip")
      """
      a = zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED)
  
      for f in fileList:
          a.write(f, os.path.relpath(f, root))
          '''I don't completely understand this, but the 'relpath' part seemed integral to not having the entire folder structure saved in the zip file'''
      a.close()
  
  makeArchive(dirEntries(ptdir), ptdir+"pts.zip", ptdir)
  makeArchive(dirEntries(polydir), polydir+"polys.zip", polydir)
  </code></pre>
  
  <p>'ptdir' and 'polydir' are defined in an earlier part of the code.</p>
  
  <p>And I get the following:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
      exec codeObject in __main__.__dict__
    File "C:\GIS_Data\Working\Python\DatabaseExport\ExportScriptTEST.py", line 181, in &lt;module&gt;
      makeArchive(dirEntries(ptdir), ptdir+"pts.zip", ptdir)
    File "C:\GIS_Data\Working\Python\DatabaseExport\ExportScriptTEST.py", line 177, in makeArchive
      for f in fileList:
  TypeError: 'NoneType' object is not iterable
  </code></pre>
  
  <p>I've gone through the process in the interactive window and don't have a problem populating the list when I take apart the functions and feed them in bit by bit, but when I run this all together I get the error. Is the issue that the list is not being populated for some reason, or is there something else going on.</p>
  
  <p>Any assistance would be greatly appreciated!</p>