title: Open a .log extension file in Python
body: <p>I'm trying to open a .log extension file in Python but I keep encountering an IOError. I'm wondering if this has to do with the extension because clearly, the only way to get into that loop was if 'some.log' existed in the directory. </p>
  
  <pre><code>location = '/Users/username/Downloads'
  
  for filename in os.listdir(location):
      if filename == 'some.log':
         f  = open('some.log', "r")
         print (f.read())
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>f  = open('some.log', "r")
  IOError: [Errno 2] No such file or directory: 'some.log'
  </code></pre>