IOError: unable to open file (File accessability: Unable to open file)

9,678 views
Skip to first unread message

Chao YUE

unread,
May 15, 2012, 9:20:58 AM5/15/12
to h5py
hello all,

I am new to hdf5 and h5py, I tried to open a file but failed.
I checked that all groups have full access to the data and so I think
it's not a problem of the permission.
could anybody have a look and give some clue?

thanks!

In [8]: data=h5py.File('GFED3.1_200009_BA.hdf','r')
---------------------------------------------------------------------------
IOError Traceback (most recent call
last)
/mnt/f/data/fire_products_data/GFED3/monthly/hdf/<ipython-input-8-
ff9b75a37763> in <module>()
----> 1 data=h5py.File('GFED3.1_200009_BA.hdf','r')

/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc in
__init__(self, name, mode, driver, libver, **kwds)
148 pass
149 fapl = make_fapl(driver,libver,**kwds)
--> 150 fid = make_fid(name, mode, fapl)
151 Group.__init__(self, fid)
152 self._shared.lcpl = make_lcpl()

/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc in
make_fid(name, mode, plist)
43 Also validates mode argument."""
44 if mode == 'r':
---> 45 fid = h5f.open(name, h5f.ACC_RDONLY, fapl=plist)
46 elif mode == 'r+':
47 fid = h5f.open(name, h5f.ACC_RDWR, fapl=plist)

/usr/local/lib/python2.7/dist-packages/h5py/h5f.so in h5py.h5f.open
(h5py/h5f.c:1618)()

IOError: unable to open file (File accessability: Unable to open file)

Thomas Caswell

unread,
May 16, 2012, 12:52:13 PM5/16/12
to h5...@googlegroups.com
On Tue, May 15, 2012 at 8:20 AM, Chao YUE <chaoy...@gmail.com> wrote:
> hello all,

> In [8]: data=h5py.File('GFED3.1_200009_BA.hdf','r')
...
>
> IOError: unable to open file (File accessability: Unable to open file)

Try giving it the full path name. As I recall, there is something
funny with the propagation of what the working directory is. I
suspect it is looking for a file with that name in some other
directory and then telling you it can't open it (because it does not
exist).

Tom

Matthew Zwier

unread,
May 16, 2012, 1:51:07 PM5/16/12
to h5...@googlegroups.com
As a less likely alternative, the same error message is given when the
HDF5 file is corrupt and cannot be opened. Try "h5ls" on the file to
see if this is the case.

Matt Z.
> --
> You received this message because you are subscribed to the Google Groups "h5py" group.
> To post to this group, send email to h5...@googlegroups.com.
> To unsubscribe from this group, send email to h5py+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/h5py?hl=en.
>

JustinJK

unread,
May 18, 2012, 6:39:24 AM5/18/12
to h5py
Hi,

I have the same problem... After finally completed the installation of
h5py, I wanted to read some HDF data, with simplicity, just read!

But the same error message come on.

I'm working on Ubuntu 12.04 and I want to try to copy my data file in /
usr/Include et .... ??? I don't know where I could copy it in order to
h5py find it...

And anyway I can't copy any file in any usr directory....

If someone has a solution it will be very cool!

Thank you for the topic.

Justin

On 16 mai, 19:51, Matthew Zwier <mczw...@gmail.com> wrote:
> As a less likely alternative, the same error message is given when the
> HDF5fileis corrupt and cannot be opened.  Try "h5ls" on thefileto
> see if this is the case.
>
> Matt Z.
>
>
>
>
>
>
>
> On Wed, May 16, 2012 at 12:52 PM, Thomas Caswell <tcasw...@gmail.com> wrote:
> > On Tue, May 15, 2012 at 8:20 AM, Chao YUE <chaoyue...@gmail.com> wrote:
> >> hello all,
>
> >> In [8]: data=h5py.File('GFED3.1_200009_BA.hdf','r')
> > ...
>
> >> IOError:unabletoopenfile(Fileaccessability:Unabletoopenfile)
>
> > Try giving it the full path name.  As I recall, there is something
> > funny with the propagation of what the working directory is.  I
> > suspect it is looking for afilewith that name in some other
> > directory and then telling you it can'topenit (because it does not

Thomas Caswell

unread,
May 18, 2012, 9:51:09 AM5/18/12
to h5...@googlegroups.com
F = h5py.File('/FULL_PATH_TO_DATA/data.h5','r')

in the terminal go to the directory where you data is and rund

pwd

which will print out the full path of the current directory. In my
code I typically have something that looks like this:

prefix = '/FULL_PATH/'
fn1 = 'data1.h5'
fn2 = 'data2.h5'

F1 = h5py.File(prefix + fn1, 'r')
F2 = h5py.File(prefix + fn2, 'r')

Tom

Don't copy stuff to any folder outside of your home directory unless
you really know what you are doing.

Tom

Justin Jacquot

unread,
May 18, 2012, 10:06:28 AM5/18/12
to h5...@googlegroups.com
I immediatly tried what I said but it doesn't work...

I join a picture of my screen. 

The main problem, I think, is that I'm only a biginner and I havn't the skills to "bounce back" on error.

But thank you very much for answering!

2012/5/18 Thomas Caswell <tcas...@gmail.com>
Capture du 2012-05-18 16:02:57.png

Thomas Caswell

unread,
May 18, 2012, 10:09:39 AM5/18/12
to h5...@googlegroups.com
capitalization matters in paths in linux,

actual path -> /home/justin/Bureau
used path -> /home/justin/bureau

Justin Jacquot

unread,
May 18, 2012, 10:13:34 AM5/18/12
to h5...@googlegroups.com
Yes you're right! I usually pay attention about that...

But it don't change anything. It's exactly the same message.



2012/5/18 Thomas Caswell <tcas...@gmail.com>

Thomas Caswell

unread,
May 18, 2012, 10:17:29 AM5/18/12
to h5...@googlegroups.com
can you go on gchat, these things are easier to work out with a lower latency.

Tom

On Fri, May 18, 2012 at 9:13 AM, Justin Jacquot

Ben Jolly

unread,
Mar 25, 2013, 6:25:29 PM3/25/13
to h5...@googlegroups.com
Did you guys end up sorting this out? I have the same problem except on Windows. The file definitely exists, I can give the exact same path (copy and paste) to Panopoly which opens it fine

Vang Le Quy

unread,
Jan 13, 2014, 7:54:03 PM1/13/14
to h5...@googlegroups.com
I am facing similar problem and I find the error messages in this case are deceiving. After much of reading, I used hd5debug (from hdf5-tools package in Ubuntu Precise) and get these error messages, which mean the file is truncated:

h5debug test.hd5
HDF5-DIAG: Error detected in HDF5 (1.8.9) thread 0:
  #000: H5F.c line 1534 in H5Fopen(): unable to open file
    major: File accessability
    minor: Unable to open file
  #001: H5F.c line 1325 in H5F_open(): unable to read superblock
    major: File accessability
    minor: Read failed
  #002: H5Fsuper.c line 351 in H5F_super_read(): unable to load superblock
    major: Object cache
    minor: Unable to protect metadata
  #003: H5AC.c line 1322 in H5AC_protect(): H5C_protect() failed.
    major: Object cache
    minor: Unable to protect metadata
  #004: H5C.c line 3567 in H5C_protect(): can't load entry
    major: Object cache
    minor: Unable to load metadata into cache
  #005: H5C.c line 7957 in H5C_load_entry(): unable to load entry
    major: Object cache
    minor: Unable to load metadata into cache
  #006: H5Fsuper_cache.c line 471 in H5F_sblock_load(): truncated file: eof = 8594182144, sblock->base_addr = 0, stored_eoa = 12944042588
    major: File accessability
    minor: File has been truncated
cannot open file


So the solution is obvious: recopy the file, and compare source and target with md5sum or something similar.
Reply all
Reply to author
Forward
0 new messages