-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
scipy.io.loadmat failure in 1.7.0 #14271
Comments
Could you provide a self-contained example? Both python code and a (minimal) matlab file, which together reproduce the problem? |
I can reproduce locally by simply running
Where I tried but can't seem to generate a new MATLAB file that can produce this effect. Even simply loading & re-saving a problem file (via MATLAB) appears to resolve the issue. Not sure what the original MATLAB version/environment/settings were when the file was created. The issue is cropping up at work where we use some MATLAB files as inputs to some unit tests. Sadly because of this I cannot supply the original files as they contain proprietary data. |
I think adding a Would you be willing to send a PR @jcharlong? Am tentatively marking it for a 1.7.1 milestone -- something was bound to start it, I suppose. |
Yes, I can take a stab at submitting a PR. Likely won't be able to get to it until this upcoming weekend at the earliest though. |
Closes scipy#14271 Resolves a rare issue when None is returned instead of a string. Returns 'None' since that's what the old "numpy.compat.asstr" implementation returned.
Closes scipy#14271 Resolves a rare issue when None is returned instead of a string. Returns 'None' since that's what the old "numpy.compat.asstr" implementation returned.
Closes scipy#14271 Resolves a rare issue when None is returned instead of a string. Returns 'None' since that's what the old "numpy.compat.asstr" implementation returned.
My issue is about a failure to load MATLAB files with scipy 1.7.0. I use
scipy.io.loadmat
(withsqueeze_me=True
) to load MATLAB files & it works just fine in 1.6.3.I traced the issue down to a change in
scipy.io.matlab.mio5.MatFile5Reader
'sget_variables
method. I noticed when diffing the 1.7.0 branch with the 1.6.3 branch that line 313 was changed fromasstr(hdr.name)
(from numpy.compat import asstr
) tohdr.name.decode('latin1')
. Looks like this change was introduced in the following commit.It appears as though
asstr
handles the case whenhdr.name is None
, which occurs with some of the MATLAB files I am working with.Reverting to using
asstr
resolves the issue & so does changing the line tohdr.name.decode('latin1') if hdr.name is not None else 'None'
(asstr(None) == 'None')
). Not sure which would be more appropriate, or ifhdr.name
even should ever beNone
.Error message:
Scipy/Numpy/Python version information:
1.7.0 1.20.3 sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
The text was updated successfully, but these errors were encountered: