title: file.readlines() returns an empty list despite seek(0)
body: <p>I am trying to read a file that already exists line by line. I have checked various options on Stackoverflow where they have mentioned to add <code>&lt;file&gt;.seek(0)</code>. This points the code to the beginning of the file. I have added this functionality as well in my code but still, it returns an empty list. Any help would be appreciated.</p>
  
  <p>Thank you!</p>
  
  <p>Tried <code>seek(0)</code> but it does not work.</p>
  
  <pre><code>#!/usr/bin/env python
  
  import subprocess
  
  class ListDirectories:
          def trash_listing(self):
                  hdfs_listing_file = open('abc.txt', 'w+')
                  subprocess.Popen("hdfs dfs -du -s -h /user/*/.Trash", stdout=hdfs_listing_file, shell=True)
                  hdfs_listing_file.close()
  
  tl = ListDirectories()
  tl.trash_listing()
  
  class DirectoryFiltering:
          def file_filtering(self):
                  with open('abc.txt', 'r') as myfile:
                          myfile.seek(0)
                          lines = myfile.readlines()
                  print(myfile)
                  print(lines)
  
  df = DirectoryFiltering()
  df.file_filtering()
  </code></pre>
  
  <p>I would expect it to give an output something like:</p>
  
  <pre><code>0 0 /user/abc/.Trash
  24 M 72 M /user/def/.Trash
  </code></pre>
  
  <p>Instead, it gives <code>[]</code> as an output.</p>