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

Issue in io.py around importing spmatrix #331

Open
rsgrimes opened this issue Sep 16, 2024 · 0 comments
Open

Issue in io.py around importing spmatrix #331

rsgrimes opened this issue Sep 16, 2024 · 0 comments

Comments

@rsgrimes
Copy link

Under Windows, I have a problem with 5.7.2 that did not exist with 5.6.0. Consider the following simple example:
(base) PS C:\Users\rsg> python
Python 3.9.12 (main, Apr 4 2022, 05:23:19) [MSC v.1916 32 bit (Intel)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.

from oct2py import Oct2Py
o = Oct2Py()
o.pwd()
Traceback (most recent call last):
File "", line 1, in
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\dynamic.py", line 111, in call
return self._ref().feval(self.name, *inputs, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\core.py", line 403, in feval
return self._feval(
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\core.py", line 620, in _feval
write_file(req, out_file, oned_as=self._oned_as,
convert_to_float=self.convert_to_float)
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 58, in write_file
data = _encode(obj, convert_to_float)
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 351, in _encode
out[key] = _encode(value, ctf)
File "C:\ProgramData\Anaconda3\lib\site-packages\oct2py\io.py", line 376, in _encode
if isinstance(data, spmatrix):
NameError: name 'spmatrix' is not defined

If you look at line 15 of the script, spmatrix is being imported from scipy.sparse, but that doesn't seem to take effect. Interestingly, adding the same import immediately before line 376 will "fix" the issue, and the o.pwd() function succeeds. Obviously, however, I'd rather not have to remember to hack Oct2Py everytime I install/upgrade it, and I'm not certain I've really fixed the underlying problem; hence, this issue.

I did post a StackOverflow question about this issue that has more details; the link to the question is below for your reference.

https://stackoverflow.com/questions/78980100/python-oct2py-octave-setup-woes

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

1 participant