title: tarfile.ReadError: file could not be opened successfully
body: <p>I have the following piece of code to open a .tgz file, but I'm getting <strong>tarfile.ReadError: file could not be opened successfully</strong>.</p>
  
  <pre><code>fp = tarfile.open('file.tgz', 'r')
  print fp.list()
  fp.close()
  </code></pre>
  
  <p>I can extract this archive using "tar -xvzf file.tgz." Apparently it has something to do with the way the file was created because when I compare two different .tgz files using <code>file</code>, I see a difference; file2.tgz works with this piece of code.</p>
  
  <pre><code>$ file file.tgz 
  file.tgz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)
  
  $ file file2.tgz 
  file2.tgz: gzip compressed data, was "", last modified: Tue Aug 19 11:16:10 2014, max compression
  </code></pre>
  
  <p>Any ideas why this is happening or how I can modify file.tgz so that it works with tarfile? </p>
  
  <p>Note: I'm using Python 2.7.5.</p>