2

I have a Matlab code which calls some python modules. I made an exe from this Matlab code (let's call it pipeMe.exe) now I'm trying to run pipeMe.exe from another python code in another machine of course but apparently, it can't set the python version executable path from the second machine, thus it gives me this error:

Undefined variable "py" or class "py.sys.path".

Is there any way that I can set the pyversion executable from outside of Matlab while I run pipeMe.exe ? Or is there any possibility to set the pyversion executable path to a path that is accessible from both machines, and I just have to set it at the beginning of my pipeMe matlab code?

Thanks in advance for your help.

  • Can you supply the path as a command-line argument to `pipeMe.exe`? – nekomatic Dec 07 '17 at 10:19
  • yes, I'm able to read any text as an input when I'm calling my exe from python. But how can this help? – Sahel Fallahdoust Dec 07 '17 at 16:58
  • I actually tried to put my executable python in a path which is accessible from all my network's machines and tried to call pyversion 'python executable path' in the beginning of my Matlab project but it gives me this error: Path argument does not specify a valid executable. – Sahel Fallahdoust Dec 07 '17 at 17:02

1 Answers1

0

Since your Matlab code has been compiled into executable (.exe), you can call it in Python using subprocess.Popen("pipeMe.exe")

If your exe file does not run, try to use deploytool of Matlab.

See also:

Kardi Teknomo
  • 1,375
  • 16
  • 24
  • Hi, Thanks for your answer but my problem is not only running my Matlab exe file from python. The problem is because I am calling some python modules from my Matlab code, when I run my Matlab exe (even using a bat file) it still can not find the python executable path. This can be solved easily with Matlab as I can call pyversion and give the executable path to it but from outside of Matlab, I don't know how to do it. – Sahel Fallahdoust Dec 11 '17 at 17:59