matlab engine for python--systemerror from en.quit()

18 views (last 30 days)
Hello, When I try to execute eng.quit() using the matlab engine for python (which is overall nice), i get this annoying Python error: --------------------------------------------------------------------------- SystemError Traceback (most recent call last) /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where) 202 else: 203 filename = fname --> 204 _builtin_.execfile(filename, *where)
/Users/samuelheroy/kccperc_rods.py in module() 23 print('The time it takes to run this program is') 24 print(time.clock()-t0) ---> 25 eng.exit()
/Users/samuelheroy/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matlab/engine/matlabengine.pyc in exit(self) 244 """ 245 if self._matlab is not None: --> 246 pythonengine.closeMATLAB(self._matlab) 247 self.__dict__["_matlab"] = None 248
SystemError: MATLAB process can not be terminated.
It's not affecting my ability to run the code, but its presence in the output is rather annoying. Does anyone know why I'm getting this, or have a fix/workaround?

Answers (1)

Sarah Palfreyman
Sarah Palfreyman on 29 Oct 2014
Hi Sam,
Can you post your Python code?
Regarding the "SystemError: MATLAB process can not be terminated." is it possible that the engine was already stopped when you called quit()?
Quiting the MATLAB engine twice ...
>>> eng=matlab.engine.start_matlab() >>> eng.eval('exit', nargout=0) >>> eng.exit()
produces a very similar error message ...
matlabengine.py", line 246, in exit pythonengine.closeMATLAB(self._matlab) SystemError: MATLAB process can not be terminated.

Community Treasure Hunt

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

Start Hunting!