为什么会弹出错误声明“类型'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 (将#修改为@)