H5PY IOError: Unable to open file (File signature not found)

Deadly 提交于 2019-12-08 04:50:44

问题


I'm having problems opening .h5 files.

I've googled around and messed about with keras but still no luck.

Here's my code :-

and this is giving me an error of :-

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import h5py

""" Reading Data from Files """

plt.close('all')

#File No.
Q = str(4)

""" Position """
with h5py.File('Data_No'+Q+'/Position_No'+Q+'.h5', 'r') as hf:
    Position = hf['Position_Data'][:]

And its giving an error which i have no idea whats going wrong :-

Traceback (most recent call last):

File "/media/gerwyn/Gerwyns_Files/Work/PLF/Animation.py", line 20, in

with h5py.File('Data_No'+Q+'/Position_No'+Q+'.h5', 'r') as hf:

File "/home/gerwyn/Documents/anaconda2/lib/python2.7/site-

packages/h5py/_hl/files.py", line 271, in init

fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)

File "/home/gerwyn/Documents/anaconda2/lib/python2.7/site-

packages/h5py/_hl/files.py", line 101, 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

IOError: Unable to open file (File signature not found)

Can someone please help me in my little predicament ?

Thanks :D

来源:https://stackoverflow.com/questions/46974600/h5py-ioerror-unable-to-open-file-file-signature-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!