title: Python .app doesn't read .txt file like it should
body: <p>This question relates to this one: <a href="https://stackoverflow.com/questions/12519610/python-app-which-reads-and-writes-into-its-current-working-directory-as-a-app-e">Python app which reads and writes into its current working directory as a .app/exe</a></p>
  
  <p>I got the path to the .txt file fine however now when I try to open it and read the contents it seems that it doesn't extract the data properly.</p>
  
  <p>Here's the relevant code:</p>
  
  <pre><code>def getLines( filename ):
      path = Cocoa.NSBundle.mainBundle().bundlePath()
  
      real_path = path[0: len(path) - 8]
  
      print real_path
  
      f = open(real_path + filename, 'r') # open the file as an object
  
      if len(f.read()) &lt;= 0:
          lines = {}                  # list to hold lines in the file
          for line in f.readlines():  # loop through the lines
              line = line.replace( "\r", "    " )
              line = line.replace( "\t", "    " )
              lines = line.split("    ")      # segment the columns using tabs as a base
          f.close()                   # close the file object
  
          return lines
  
  lines = getLines( "raw.txt" )
  for index, item in enumerate( lines ):        # iterate through lines
      # ...
  </code></pre>
  
  <p>These are the errors I'm getting:</p>
  
  <ul>
  <li>30/09/2012 10:28:49.103 [0x0-0x4e04e].org.pythonmac.unspecified.main:     for index, item in enumerate( lines ):     # iterate through lines</li>
  <li>30/09/2012 10:28:49.103 [0x0-0x4e04e].org.pythonmac.unspecified.main: TypeError: 'NoneType' object is not iterable</li>
  </ul>
  
  <p>I kind of understand what the errors mean however I'm not sure why they are being flagged up because if I run my script with it not in a .app form it doesn't get these errors and extracts the data fine.</p>