【发布时间】:2018-08-12 04:02:16
【问题描述】:
我有一个python3.6的程序,使用nibabel包分析NIFTI格式的医学图像。
import glob
import nibabel as nib
health = [nib.load(pt) for pt in glob.glob(healthdir+'*.nii')] # len = 200
health_data = [h.get_data() for h in health]
最后一行出现OSError: [Errno 24] Too many open files。我使用了以下代码,发现它在最后一个元素中发生了错误。
health_data = []
for i in range(len(health)):
try:
health_data.append(health[i].get_data())
except:
print(i) # 199
我曾尝试搜索相关主题,例如
Nibabel: IOError: [Errno 24] Too many open files:。但是,它并不能解决问题。另外,我不喜欢使用ulimit。谢谢!
【问题讨论】:
-
嗨@djfire,你有没有设法解决这个问题?
标签: python image macos operating-system medical