我发现自己不得不使用python脚本来访问web存档。从Python打开megawarc存档时出错
我所拥有的是一个来自http://archive.org/details/archiveteam-fanfiction-warc-11的'megawarc'网络归档文件。我需要使用在https://github.com/alard/megawarc处找到的python脚本来取消这个megawarc。
我试图运行'restore'命令,并从第一个链接获取所需的三个文件(FILE.warc.gz, FILE.tar和FILE.json.gz)。
我安装了python 2.7和3.3。
-------------- --------------更新
我已经跑了两个这种方法..
python megawarc restore FILE
而且这种方法..
请确保您有在同一个目录中的文件megawarc和ordereddict.py,你要转换的文件。 重命名文件megawarc到megawarc.py 打开一个python控制台使用Python 2.7这个目录
Type the following code (line by line) :
import sys
sys.argv = ['megawarc','restore','FILE']
import megawarc
megawarc.main()
在,这就是我得到..
c:\Python27>python megawarc restore FILE
Traceback (most recent call last):
File "megawarc", line 563, in <module>
main()
File "megawarc", line 552, in main
mwr.process()
File "megawarc", line 460, in process
self.process_entry(entry, tar_out)
File "megawarc", line 478, in process_entry
entry["target"]["offset"], entry["target"]["size"])
File "megawarc", line 128, in copy_to_stream
raise Exception("End of file: %d bytes expected, but %d bytes read." % (buf_size, l))
Exception: End of file: 4096 bytes expected, but 236 bytes read.
有没有别的东西,我很失踪?
我有以下的文件都在 C:\ python27
FILE.megawarc.json.gz
FILE.megawarc.tar
FILE.megawarc.warc.gz
megawarc
ordereddict.py
这是某种类型的损坏文件的错误?有什么我失踪?
你尝试了什么,你得到了什么错误? –
Pssh,没有人有错误的编程思维。简单地说,你一直试图解决编程问题意味着你可以成为一名优秀的程序员。这都是关于解决问题的。 –
那么你执行了你给的Python脚本?你打开了一个命令shell来运行它,以便你能看到错误信息吗? – duffymo