You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "<input>", line 10, in<module>
File "...\venv310\lib\site-packages\scipy\io\matlab\_mio.py", line 300, in savemat
MW.put_variables(mdict)
File "...\venv310\lib\site-packages\scipy\io\matlab\_mio5.py", line 884, in put_variables
self._matrix_writer.write_top(var, name.encode('latin1'), is_global)
File "...\venv310\lib\site-packages\scipy\io\matlab\_mio5.py", line 633, in write_top
self.write(arr)
File "...\venv310\lib\site-packages\scipy\io\matlab\_mio5.py", line 651, in write
narr = to_writeable(arr)
File "...\venv310\lib\site-packages\scipy\io\matlab\_mio5.py", line 493, in to_writeable
narr = np.asanyarray(source)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
SciPy/NumPy/Python version information
Scipy: 1.10.0; Numpy: 1.24.2
The text was updated successfully, but these errors were encountered:
Sorry, I do not understand. What in addition to the example under "Reproducing Code Example" from my initial post is needed?
On my setup this raises the error and aborts writing the mat-file.
Describe your issue.
After updating numpy to a version >=1.24 an error is thrown as the behavior of numpy asanyarry has changed from a deprecation warning to an error. For reference:
https://numpy.org/doc/stable/release/1.24.0-notes.html
and
numpy/numpy#22004
Possible workaround:
Wrapping the line 493 of _mio5.py within a try catch:
scipy/scipy/io/matlab/_mio5.py
Line 493 in dde5059
Replace:
with
Reproducing Code Example
Error message
SciPy/NumPy/Python version information
Scipy: 1.10.0; Numpy: 1.24.2
The text was updated successfully, but these errors were encountered: