Effacer les filtres
Effacer les filtres

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

15 vues (au cours des 30 derniers jours)
SAMUEL HEROY
SAMUEL HEROY le 29 Oct 2014
Modifié(e) : sanlin ke le 25 Août 2023
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?

Réponses (1)

Sarah Palfreyman
Sarah Palfreyman le 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.
  1 commentaire
sanlin ke
sanlin ke le 25 Août 2023
Modifié(e) : sanlin ke le 25 Août 2023
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!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by