【发布时间】:2014-09-11 10:16:09
【问题描述】:
我正在尝试使用以下链接中的工具箱使用 python 打开一个 warc 文件: http://warc.readthedocs.org/en/latest/
打开文件时:
import warc
f = warc.open("00.warc.gz")
一切都很好,f 对象是:
<warc.warc.WARCFile instance at 0x1151d34d0>
但是,当我尝试使用以下方式读取文件中的所有内容时:
for record in f:
print record['WARC-Target-URI'], record['Content-Length']
出现如下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/xxx/anaconda/lib/python2.7/site-packages/warc/warc.py", line 390, in __iter__
record = self.read_record()
File "/Users/xxx/anaconda/lib/python2.7/site-packages/warc/warc.py", line 373, in read_record
header = self.read_header(fileobj)
File "/Users/xxx/anaconda/lib/python2.7/site-packages/warc/warc.py", line 331, in read_header
raise IOError("Bad version line: %r" % version_line)
IOError: Bad version line: 'WARC/0.18\n'
这是因为我正在使用的 warc 工具箱或其他东西不支持我的 warc 文件版本吗?
【问题讨论】:
-
这就是错误所说的。
标签: python-2.7 warc