读取h5文件出错

报错内容:

fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 100, in h5py.h5f.open
FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '/home/wzc/SSL-exp/data/LIVER_fix/data/slices/MR103933_slice_0
.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

通过debug发现:

 case最后还带着\n,所以路径出错

我的解决方案是字符串取到倒2,能去掉\n就行

 debug就可以通过啦

可以正常读取h5文件了

 解决方案:

debug看一下你们的路径最后是不是带着\n!!!!

猜你喜欢

转载自blog.csdn.net/Wjeana/article/details/126002728