I try to open a file which I can get its information by ls -l in terminal or glob.glob(path) in python, but I can not open() it or np.load() it. Here are the command,
path='xxx'
glob.glob(path)
open(path, 'r')
and here are the outputs,
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> path = '/data00/home/zhangbowen.17/code/text_rec/dataset/BigAndSmallDataset/cut_100_big_user_video_500_mine_precomp/train_cnn_fea.npy'
>>> import glob
>>> glob.glob(path)
['/data00/home/zhangbowen.17/code/text_rec/dataset/BigAndSmallDataset/cut_100_big_user_video_500_mine_precomp/train_cnn_fea.npy']
>>> open(path, 'r')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/data00/home/zhangbowen.17/code/text_rec/dataset/BigAndSmallDataset/cut_100_big_user_video_500_mine_precomp/train_cnn_fea.npy'
By the way, np.load() has the same result. However, I can get the information by ls -l in terminal.
glob()
give you if you specify a filename that doesn't exist? The thing I'm wondering is what it does when it gets a pattern that doesn't resolve to anything. Also, the docs contain a note about broken symlinks, which could be a cause. – Ulrich Eckhardtls -l
shows for this file? Maybe it's a broken symlink? – Alexlrwxrwxrwx 1 zhangbowen.17 zhangbowen.17 52 Dec 1 2020 /data00/home/zhangbowen.17/code/text_rec/dataset/BigAndSmallDataset/cut_100_big_user_video_500_mine_precomp/train_cnn_fea.npy -> ../../dataset_list/cut100_big_user_train_res_fea.npy
– zhangbwcat
it? – Alex