h5py.File() gives error message
Rob Gaddi
rgaddi at highlandtechnology.invalid
Tue Oct 24 21:02:26 EDT 2017
On 10/24/2017 10:58 AM, C W wrote:
> Dear list,
>
> The following Python code gives an error message
>
> # Python code starts here:
> import numpy as np
> import h5py
> train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
>
> # Python code ends
>
> The error message:
>
> train_dataset = h5py.File('train_catvnoncat.h5', "r")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
> line 269, in __init__
> fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
> File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
> line 99, in make_fid
> 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 78, in h5py.h5f.open
> OSError: Unable to open file (unable to open file: name =
> 'train_catvnoncat.h5', errno = 2, error message = 'No such file or
> directory', flags = 0, o_flags = 0)
>
> My directory is correct, and the dataset folder with file is there.
>
> Why error message? Is it h5py.File() or is it my file? Everything seems
> pretty simple, what's going on?
>
> Thank you!
>
Be 100% sure your directory is correct. Try it again with an absolute
path to the file. Windows makes it far too easy for the working
directory of a program to be other than what you think it is.
--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order. See above to fix.
More information about the Python-list
mailing list