Matlab h5read and Python h5py Conflict
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
We are testing out the Matlab Library Compiler in order to produce Python libraries of some of our Matlab functions. We work with the HDF5 file format and therefore invoke the Matlab h5read function frequently.
We are encountering errors when a Python script imports h5py as well as our in-house package which calls h5read.
Some details:
Matlab version R2021b
Python 3.9.18
h5py version 3.10.0
We have tested with a simplified package (called here test_h5read)and a simple python script in order to reproduce the issue.
In the python script we have the following :
_______________________________________________________
import test_h5read
import h5py # Without this import statement, the script executes successfully
# When importing h5py, below error occurs.
pkg = test_h5read.initialize()
Raw_cube = 'test_cube.h5'
pkg.test_h5read(Raw_cube, nargout=0)
pkg.terminate()
________________________________________________________
Error Output:
python .\testMatlabPkg.py
One or more output arguments not assigned during call to "h5readc".
Error in h5read (line 93)
Error in test_h5read (line 5)
Traceback (most recent call last):
File "C:\Users\swdevs\Dev\TestMatlabPackage\testMatlabPkg.py", line 7, in <module>
pkg.test_h5read(Raw_cube, nargout=0)
File "C:\Program Files\MATLAB\MATLAB Runtime\v911\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\deployablefunc.py", line 79, in __call__
ret = futureresult.FutureResult(self._cppext_handle, future_tuple, nlhs,
File "C:\Program Files\MATLAB\MATLAB Runtime\v911\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 135, in result
raise e
File "C:\Program Files\MATLAB\MATLAB Runtime\v911\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 123, in result
raise e
File "C:\Program Files\MATLAB\MATLAB Runtime\v911\toolbox\compiler_sdk\pysdk_py\matlab_pysdk\runtime\futureresult.py", line 112, in result
self._result = self._cppext_handle.getFEvalResult(self._future_tuple,
matlab_pysdk.runtime.MatlabRuntimeError: An error occurred when evaluating the result from a function. Details:
File C:\Program Files\MATLAB\MATLAB Runtime\v911\mcr\toolbox\matlab\imagesci\h5read.m, line 93, in h5read
File C:\Users\swdevs\AppData\Local\Temp\swdevs\mcrCache9.11\test_h0\test_h5read\test_h5read.m, line 5, in test_h5read
One or more output arguments not assigned during call to "h5readc".
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!