python - 无法打开用 Python 制作的 zip 文件
问题描述
预处理后,我从 dicom 文件创建了 1594 个 .npz 文件。现在我想使用 np.load() 方法打开那里的 zip 文件,但它给出了错误的 zip 文件错误。问题是,这适用于一批 20 但不是 1594。是因为 np.load() 无法打开这么多 zip 文件,还是在创建 zip 文件时会出现问题,比如导致此错误的干扰?
patients = os.listdir(preprocessed_data_folder)
shuffle(patients) # randomize the order of data
# initialization
for i in range(len(patients)):
if patients[i].startswith('.'): continue # ignore hidden files
#patient_data =
if np.load(preprocessed_data_folder + patients[i])['set'] == 'test': continue
我得到的错误是
C:\Users\sahana\anaconda3\lib\zipfile.py in _RealGetContents(self)
1323 raise BadZipFile("File is not a zip file")
1324 if not endrec:
-> 1325 raise BadZipFile("File is not a zip file")
1326 if self.debug > 1:
1327 print(endrec)
BadZipFile: File is not a zip file
解决方案
推荐阅读
- android - 在 Android 中收到来电时朗读录音文本
- java - 如何异步读取 JSON 并在 android 中使用它的数据?
- javascript - 在某些网站上不尊重顶部和左侧定位
- c - 结构在链表 C 语言中不起作用
- android - 注册成功但使用firebase时登录失败
- java - 错误:未报告的异常IOException;必须被抓住或宣布被扔掉
- networking - 验证和优化 IPTable 和 squid 防火墙规则
- webpack - Webpack #.bundle.js 文件
- r - 用 R 处理 xlsm
- mysql - 插入查询问题我得到“#1054 - '字段列表'中的未知列'Dorel'”,请提供一些建议,您可以在下面看到我的查询