微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么会弹出错误声明“类型'NoneType'的参数不可迭代”?

如何解决为什么会弹出错误声明“类型'NoneType'的参数不可迭代”?

我的python代码

import os
os.environ['OCTAVE_EXECUTABLE'] = "D:\Octave\Octave-5.2.0\mingw64\bin\octave-cli.exe"

from oct2py import octave

octave.addpath('C:/Users/Owner/OneDrive/Desktop/Hiwi/2nd work');
aaa = octave.a(2)

print(aaa)

我的matlab代码

function c = a(b)
    c = b+1;

,但系统表示存在错误。我不知道是什么问题。

Traceback (most recent call last):
  File "c:/Users/Owner/OneDrive/Desktop/Hiwi/2nd work/python/practice.py",line 13,in <module>
    from oct2py import octave
  File "D:\Anaconda3\lib\site-packages\oct2py\__init__.py",line 38,in <module>
    octave = Oct2Py()
  File "D:\Anaconda3\lib\site-packages\oct2py\core.py",line 76,in __init__
    self.restart()
  File "D:\Anaconda3\lib\site-packages\oct2py\core.py",line 520,in restart
    self._engine = OctaveEngine(stdin_handler=self._handle_stdin,File "D:\Anaconda3\lib\site-packages\octave_kernel\kernel.py",line 170,in __init__
    self.executable = self._get_executable()
  File "D:\Anaconda3\lib\site-packages\octave_kernel\kernel.py",line 453,in _get_executable
    if 'snap' not in fullpath:TypeError: argument of type 'nonetype' is not iterable

第453行的详细信息是

    def _get_executable(self):
        # Find the best octave executable.

        # Attempt to get the octave executable
        executable = os.environ.get('OCTAVE_EXECUTABLE',None)
        if executable:
            fullpath = which(executable)
line 453    if 'snap' not in fullpath:
                executable = fullpath
                if 'octave-cli' not in executable:
                    raise OSError('OCTAVE_EXECUTABLE does not point to an octave-cli file,please see README')

我的python,八度和oct2py版本是

Python 3.8.3

八度5.2.0

oct2py 5.2.0

八度内核0.32.0

您能解释一下这是什么问题吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。