<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Dear Users,</p>
<p>I am trying to open a .h5 file in jupyter-notebook. Please anyone
guide me about reading of HDF files.</p>
<p><b><u>Command;</u></b></p>
<p><br>
</p>
<p>import h5py <br>
filename = "ct_multilevel-err.h5"<br>
with h5py.File(filename, "r") as f:<br>
# List all groups<br>
print("Keys: %s" % f.keys())<br>
a_group_key = list(f.keys())[0]<br>
<br>
# Get the data<br>
data = list(f[a_group_key])</p>
<p><b><u>Error;</u></b></p>
<pre><span class="ansi-red-fg">IOError</span> Traceback (most recent call last)
<span class="ansi-green-fg"><ipython-input-12-769b4593257a></span> in <span class="ansi-cyan-fg"><module></span><span class="ansi-blue-fg">()</span>
<span class="ansi-green-intense-fg ansi-bold"> 1</span> filename <span class="ansi-blue-fg">=</span> <span class="ansi-blue-fg">"ct_multilevel-err.h5"</span>
<span class="ansi-green-fg">----> 2</span><span class="ansi-red-fg"> </span><span class="ansi-green-fg">with</span> h5py<span class="ansi-blue-fg">.</span>File<span class="ansi-blue-fg">(</span>filename<span class="ansi-blue-fg">,</span> <span class="ansi-blue-fg">"r"</span><span class="ansi-blue-fg">)</span> <span class="ansi-green-fg">as</span> f<span class="ansi-blue-fg">:</span>
<span class="ansi-green-intense-fg ansi-bold"> 3</span> <span class="ansi-red-fg"># List all groups</span>
<span class="ansi-green-intense-fg ansi-bold"> 4</span> <span class="ansi-green-fg">print</span><span class="ansi-blue-fg">(</span><span class="ansi-blue-fg">"Keys: %s"</span> <span class="ansi-blue-fg">%</span> f<span class="ansi-blue-fg">.</span>keys<span class="ansi-blue-fg">(</span><span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">)</span>
<span class="ansi-green-intense-fg ansi-bold"> 5</span> a_group_key <span class="ansi-blue-fg">=</span> list<span class="ansi-blue-fg">(</span>f<span class="ansi-blue-fg">.</span>keys<span class="ansi-blue-fg">(</span><span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">[</span><span class="ansi-cyan-fg">0</span><span class="ansi-blue-fg">]</span>
<span class="ansi-green-fg">/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc</span> in <span class="ansi-cyan-fg">__init__</span><span class="ansi-blue-fg">(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)</span>
<span class="ansi-green-intense-fg ansi-bold"> 406</span> fid = make_fid(name, mode, userblock_size,
<span class="ansi-green-intense-fg ansi-bold"> 407</span> fapl<span class="ansi-blue-fg">,</span> fcpl<span class="ansi-blue-fg">=</span>make_fcpl<span class="ansi-blue-fg">(</span>track_order<span class="ansi-blue-fg">=</span>track_order<span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">,</span>
<span class="ansi-green-fg">--> 408</span><span class="ansi-red-fg"> swmr=swmr)
</span><span class="ansi-green-intense-fg ansi-bold"> 409</span>
<span class="ansi-green-intense-fg ansi-bold"> 410</span> <span class="ansi-green-fg">if</span> isinstance<span class="ansi-blue-fg">(</span>libver<span class="ansi-blue-fg">,</span> tuple<span class="ansi-blue-fg">)</span><span class="ansi-blue-fg">:</span>
<span class="ansi-green-fg">/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc</span> in <span class="ansi-cyan-fg">make_fid</span><span class="ansi-blue-fg">(name, mode, userblock_size, fapl, fcpl, swmr)</span>
<span class="ansi-green-intense-fg ansi-bold"> 171</span> <span class="ansi-green-fg">if</span> swmr <span class="ansi-green-fg">and</span> swmr_support<span class="ansi-blue-fg">:</span>
<span class="ansi-green-intense-fg ansi-bold"> 172</span> flags <span class="ansi-blue-fg">|=</span> h5f<span class="ansi-blue-fg">.</span>ACC_SWMR_READ
<span class="ansi-green-fg">--> 173</span><span class="ansi-red-fg"> </span>fid <span class="ansi-blue-fg">=</span> h5f<span class="ansi-blue-fg">.</span>open<span class="ansi-blue-fg">(</span>name<span class="ansi-blue-fg">,</span> flags<span class="ansi-blue-fg">,</span> fapl<span class="ansi-blue-fg">=</span>fapl<span class="ansi-blue-fg">)</span>
<span class="ansi-green-intense-fg ansi-bold"> 174</span> <span class="ansi-green-fg">elif</span> mode <span class="ansi-blue-fg">==</span> <span class="ansi-blue-fg">'r+'</span><span class="ansi-blue-fg">:</span>
<span class="ansi-green-intense-fg ansi-bold"> 175</span> fid <span class="ansi-blue-fg">=</span> h5f<span class="ansi-blue-fg">.</span>open<span class="ansi-blue-fg">(</span>name<span class="ansi-blue-fg">,</span> h5f<span class="ansi-blue-fg">.</span>ACC_RDWR<span class="ansi-blue-fg">,</span> fapl<span class="ansi-blue-fg">=</span>fapl<span class="ansi-blue-fg">)</span>
<span class="ansi-green-fg">h5py/_objects.pyx</span> in <span class="ansi-cyan-fg">h5py._objects.with_phil.wrapper</span><span class="ansi-blue-fg">()</span>
<span class="ansi-green-fg">h5py/_objects.pyx</span> in <span class="ansi-cyan-fg">h5py._objects.with_phil.wrapper</span><span class="ansi-blue-fg">()</span>
<span class="ansi-green-fg">h5py/h5f.pyx</span> in <span class="ansi-cyan-fg">h5py.h5f.open</span><span class="ansi-blue-fg">()</span>
<b><span class="ansi-red-fg">IOError</span></b><b>: Unable to open file (unable to open file: name = 'ct_multilevel-err.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)</b>
</pre>
</body>
</html>