title: How to unpack xz file with python which contains only data but no filename?
body: <p>I have a file, which I can decompress under linux using the following command:</p>
  
  <pre><code>unxz &lt; file.xz &gt; file.txt
  </code></pre>
  
  <p>How can I do the same using python?
  If I use python3 and the tarfile module and do the following:</p>
  
  <pre><code>import sys
  import tarfile
  try:
      with tarfile.open('temp.xz', 'r:xz') as t:
          t.extract()
  except Exception as e:
      print("Error:", e.strerror)
  </code></pre>
  
  <p>I get the exception: <em>ReadError('invalid header',)</em>. So apparently it expects some file- or directory information which is not present in the xz file.</p>
  
  <p>So how can I decompress a file without header information?</p>