0

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.

Aubrey
  • 507
  • 4
  • 20

1 Answers1

0

I finally discovered the problem reading this question. I had called my script warc.py, and that generated the conflict. Careful how you name your files.

Community
  • 1
  • 1
Aubrey
  • 507
  • 4
  • 20