matlab engine for python--systemerror from en.quit()
조회 수: 9 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Sarah Palfreyman
2014년 10월 29일
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.
댓글 수: 1
sanlin ke
2023년 8월 25일
편집: sanlin ke
2023년 8월 25일
Hi, I'm having the same problem.
Exception ignored in: <function MatlabEngine.__del__ at 0x0000017B23790DC0>
Traceback (most recent call last):
File "C:\Python\Python39\lib\site-packages\matlab\engine\matlabengine.py", line 250, in __del__
self.exit()
File "C:\Python\Python39\lib\site-packages\matlab\engine\matlabengine.py", line 232, in exit
pythonengine.closeMATLAB(self.__dict__["_matlab"])
SystemError: MATLAB process cannot be terminated.
Could you help reply? Thanks!
참고 항목
카테고리
Help Center 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!