Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复';输入/输出错误';提取zipfile时?_Python_Zipfile - Fatal编程技术网

Python 如何修复';输入/输出错误';提取zipfile时?

Python 如何修复';输入/输出错误';提取zipfile时?,python,zipfile,Python,Zipfile,我正在使用一个150GB以上的dicom图像压缩文件。 我试图通过文件名提取其中的一些 我正在使用google collab python 3解释器,在长度为500的文件名列表上使用zipfile模块和zipfile.extractall()方法(例如:['stage_1_train_images/ID_53ff71bc4.dcm','stage_1_train_images/ID_001bb2c00.dcm',等等]: . 这是我的密码: from zipfile import ZipFil

我正在使用一个150GB以上的dicom图像压缩文件。 我试图通过文件名提取其中的一些

我正在使用google collab python 3解释器,在长度为500的文件名列表上使用zipfile模块和zipfile.extractall()方法(例如:['stage_1_train_images/ID_53ff71bc4.dcm','stage_1_train_images/ID_001bb2c00.dcm',等等]: .

这是我的密码:

from zipfile import ZipFile 

with ZipFile(src, 'r') as zipObj:
     zipObj.extractall(members = ids, path = '/content/drive/My Drive/RSNA IH DETECTION CHALLENGE/DICOM') #ids is my file list
我收到一条错误消息:

"OSError: [Errno 5] Input/output error", related to a message in read(self, n) :    "727     "Close the writing handle before trying to read.")"
我尝试关闭文件并重新打开它,多次尝试使用.extract()方法提取,但始终收到相同的错误消息

我第一次尝试将fuse-zip与
shutil.copyfile()
一起使用,但失败了

您知道导致此错误消息的原因以及修复此错误消息的可能方法吗


谢谢你的回答

我通过重新下载原始文件修复了这个问题。 存储在谷歌硬盘上的我的版本可能已损坏。
现在fuse-zip和ZipFile方法一样有效

你确定
ids
没有包含与src-zip文件同名的zip文件吗?不幸的是,没有:我的src-zip文件名为“rsna颅内出血检测.zip”,我的ID都是“stage\u 1\u train\u images/ID\w{9}.dcm”格式的。你是否尝试过使用标准解压命令解压它?可能该文件已损坏。由于我的存储容量限制在350GB,当我尝试使用标准解压命令(我想你指的是ZipFile.extractall()方法)时,它使我的环境崩溃…你可以尝试使用额外的参数来解压一些文件。也可以使用较小的文件进行测试。我打算使用一个非python的
解压
可执行文件