2016-11-16 82 views
0

您好我無法加載與h5py一個HDF5文件:轉換轉換爲大寫加載文件與h5py時小寫

$ python verif.py 
Traceback (most recent call last): 
    File "verif.py", line 4, in <module> 
    h5f = h5py.File("../DeepFISH-Github_projects/DeepFISH/dataset/'+'LowRes_13434_overlapping_pairs.h5",'r') 
    File "/home/jeanpat/VirtualEnv/venv3/lib/python3.5/site-packages/h5py/_hl/files.py", line 272, in __init__ 
    fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr) 
    File "/home/jeanpat/VirtualEnv/venv3/lib/python3.5/site-packages/h5py/_hl/files.py", line 92, in make_fid 
    fid = h5f.open(name, flags, fapl=fapl) 
    File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-at6d2npe-build/h5py/_objects.c:2684) 
    File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-at6d2npe-build/h5py/_objects.c:2642) 
    File "h5py/h5f.pyx", line 76, in h5py.h5f.open (/tmp/pip-at6d2npe-build/h5py/h5f.c:1930) 
OSError: Unable to open file (Unable to open file: name = '../deepfish-github_projects/deepfish/dataset/'+'lowres_13434_overlapping_pairs.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0 

含有該文件的路徑字符串:

../DeepFISH-Github_projects/DeepFISH/dataset'+'LowRes_13434_overlapping_pairs.h5 

似乎被修改h5py

../deepfish-github_projects/deepfish/dataset/lowres_13434_overlapping_pairs.h5 

我可以修改目錄名稱,但它很奇怪。

回答

1

在這一行

h5f = h5py.File("../DeepFISH-Github_projects/DeepFISH/dataset/'+'LowRes_13434_overlapping_pairs.h5",'r') 

你試圖打開一個文件在其名字字面'+'。外部引號是雙引號,所以字符串中的單引號只是名稱的一部分。你可能想使用方法是:

h5f = h5py.File("../DeepFISH-Github_projects/DeepFISH/dataset/" + "LowRes_13434_overlapping_pairs.h5",'r') 

我不知道爲什麼錯誤信息是全部小寫,也許庫嘗試找到一個不區分大小寫的方式文件,如果它不被發現原始名稱或底層文件系統不區分大小寫,這就是操作系統報告丟失文件錯誤的方式。