EOFError: compressed file ended before the logical end-of-stream was detected in decompressing bz2 file

EOFError: compressed file ended before the logical end-of-stream was detected in decompressing bz2 file

当我尝试解压缩维基百科转储以使用其 .xml 文件时出现此错误。我该如何解决?

filepath='/Data/nlp/ESA/Wiki-ESA-master'
file_name='enwiki-latest-pages-articles.xml.bz2'
zipfile = bz2.BZ2File(file_name) # open the file
DEFAULT_FILENAME = zipfile.read() # get the decompressed data

错误:

EOFError: compressed file ended before the logical end-of-stream was detected

如错误所述,下载过程很可能提前结束,您的文件被截断了。尝试重新下载。

另一个原因可能是磁盘上的数据已损坏。重新下载也可能对此有所帮助。