MATLAB Answers

0

Why can't I run my python script from Matlab?

Asked by Stelios Fanourakis on 13 May 2019
Latest activity Answered by Prathamesh Degwekar on 21 May 2019
Hi
I am trying to use this line
py.intervals.py();
Where intervals is a python script. I get the error
>> py.intervals.py()
Undefined variable "py" or class "py.intervals.py".
I am using R2018b. Do I need to purchase a Python Libraries API?

  0 Comments

Sign in to comment.

2 Answers

Answer by Jan
on 17 May 2019

  1 Comment

Yes I have seen the Python Libraries. I got the errors
Import argument 'intervals.py' cannot be found or cannot be imported.

Sign in to comment.


Answer by Prathamesh Degwekar on 21 May 2019

Hi,
I see two possible corrections you could try. Firstly try calling the python module itself instead of the file name (like "py.mymod.search(N)" instead of "py.mymod.py").
Secondly, maybe your file isn't in the python search path. If it isn't, try adding your folder to the python sys path using:
if count(py.sys.path,'') == 0
insert(py.sys.path,int32(0),'');
end

  0 Comments

Sign in to comment.