필터 지우기
필터 지우기

Error when calling python module from MATLAB

조회 수: 2 (최근 30일)
cho_the_wombat
cho_the_wombat 2015년 7월 1일
댓글: cho_the_wombat 2015년 7월 2일
Hi,
I am trying this MATLAB example to call a user-defined python module (mymod.py).
When I tried running
py.mymod.search({'john','johnson','james'})
I got this error message:
Error using py.mymod.search. The specified superclass 'python.internal.MutableSequence' contains a parse error, cannot be found on MATLAB's search path, or is shadowed by another file with the same name.
I know the module is on the path because MATLAB returns the related information when I run
py.importlib.import_module('mymod')
So it must be due to a parsing error or an identical name. How should I solve this problem? Does "the same name" in the error message refer to mymod or the superclass name MutableSequence?
Thanks in advance.

채택된 답변

Robert Snoeberger
Robert Snoeberger 2015년 7월 2일
Did you do anything to change MATLAB's search path?
To solve this problem you need to make sure the MATLAB package python.internal is on MATLAB's search path. Use Jan Simon's answer to this question to check if the following folder is on the MATLAB path.
Folder = fullfile(matlabroot, 'toolbox', 'matlab', 'external', 'interfaces', 'python');
  댓글 수: 1
cho_the_wombat
cho_the_wombat 2015년 7월 2일
It turned out python.internal was not on MATLAB's search path. I added the folder and now am able to run python in MATLAB. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by