My whole code is
import warc
f = warc.open("file.warc.gz")
for record in f:
print record['WARC-Target-URI'], record['Content-Length']
But it gives me this error:
File "warc.py", line 1, in <module>
import warc
File "/path/warc.py", line 3, in <module>
f = warc.open("file.warc.gz")
AttributeError: 'module' object has no attribute 'open'
I just installed warc with sudo pip install warc
, following these instructions. The code too is just a copy and paste from that page.
I don't understand why the import doesn't work. I tried to upgrade the installation too, but it's already up to date.