reading *.lz4 file in python
<p>I have a huge number of tweet data that are compressed in lz4 formats. I'd like to open each file and decompress it, and extract some information from python. </p>

<p>When I decompress the file using <code>lz4c -d</code> command in Ubuntu, the file decompresses just fine. But when I use <code>lz4.loads('path_to_file')</code> in python, it complains that <code>ValueError: corrupt input at byte 6</code>. The same error message happens when I try to read() the file in bytes mode. What do I do? </p>

<p>Try with the lz4tools package instead: <a href="https://pypi.python.org/pypi/lz4tools" rel="nofollow">https://pypi.python.org/pypi/lz4tools</a></p>

<p>My test fails with <code>lz4</code></p>

<pre><code>&gt;&gt;&gt; lz4.loads(open("test.js.lz4","rb").read())
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ValueError: corrupt input at byte 10
</code></pre>

<p>But works with <code>lz4tools</code></p>

<pre><code>&gt;&gt;&gt; lz4tools.open("test.js.lz4").read()
'[{\n    "cc_emails": [],\n    "fwd_emails": [],\n    "reply_cc_emails": [],\n    "fr_escalated": false,\n    "spam": false,\n    "emai.....
</code></pre>

python lz4