Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDF5File.__init() requires a fileID #81

Open
wpf5511 opened this issue Sep 13, 2016 · 3 comments
Open

HDF5File.__init() requires a fileID #81

wpf5511 opened this issue Sep 13, 2016 · 3 comments

Comments

@wpf5511
Copy link

wpf5511 commented Sep 13, 2016

when I process hdf5.open('filepath','r')

th> hdf5.open('bot.hdf5','r')
/opt/torch/install/share/lua/5.1/hdf5/file.lua:10: HDF5File.__init() requires a fileID - perhaps you want HDF5File.create()?
stack traceback:
[C]: in function 'assert'
/opt/torch/install/share/lua/5.1/hdf5/file.lua:10: in function '__init'
/home/wpf/.luarocks/share/lua/5.1/torch/init.lua:91: in function </home/wpf/.luarocks/share/lua/5.1/torch/init.lua:87>
[C]: in function 'open'
[string "_RESULT={hdf5.open('bot.hdf5','r')}"]:1: in main chunk
[C]: in function 'xpcall'
/opt/torch/install/share/lua/5.1/trepl/init.lua:652: in function 'repl'
/opt/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00405b50
[0.0011s]
th>

@cpra
Copy link

cpra commented Mar 14, 2017

In case anyone runs into this issue, you can fix it as follows. This is not safe wrt. package updates though.

The problem is that hdf5.C.H5Fopen returns fileID as type cdata. To fix this, add the following after local fileID = hdf5.C.H5Fopen(...) in openFunc: fileID = tonumber(fileID). Then you'll probably get another error in group.lua, line 73. To fix this error, replace .. self._groupID .. with .. tostring(self._groupID) ...

@AndreJFBico
Copy link

Btw this is still happening on latest version with macos .

@theSundayProgrammer
Copy link

theSundayProgrammer commented Sep 27, 2017

@cpra suggestion fixed me partly. There is one more place where the error occurs and I could not trace it (see listing below). So I commented out the offending assert in file.lua and added an explicit conversion
fileID=tonumber(fileID)

listing--------
/home/chakra/torch/install/bin/luajit: /home/chakra/torch/install/share/lua/5.1/hdf5/file.lua:10: HDF5File.__init() requires a fileID - perhaps you want HDF5File.create()?
stack traceback:
[C]: in function 'assert'
/home/chakra/torch/install/share/lua/5.1/hdf5/file.lua:10: in function '__init'
/home/chakra/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/chakra/torch/install/share/lua/5.1/torch/init.lua:87>
[C]: in function 'open'
./util/DataLoader.lua:17: in function '__init'
/home/chakra/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/chakra/torch/install/share/lua/5.1/torch/init.lua:87>
[C]: in function 'DataLoader'
train.lua:76: in main chunk
[C]: in function 'dofile'
...akra/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x55b81bec1470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants