EngineError: Transport stopped. by using MATLAB Engine for Python after activation of MATLAB
EngineError: Transport stopped. by using MATLAB Engine for Python after activation of MATLAB
我按照的方案安装了MATLAB Engine,也启动了,但是执行时出现如下错误:
Traceback (most recent call last):
File "<ipython-input-1-7f0848dd34ed>", line 1, in <module>
runfile('/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py', wdir='/media/geodasie/dat/Dennis/Python/PythonProgram')
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py", line 288, in <module>
eng = matlab.engine.start_matlab() # start Matlab
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/__init__.py", line 115, in start_matlab
eng = future.result()
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
EngineError: Transport stopped.
出现错误的代码序列是:
Path_year = fileName[19:23] + '/'
Path_month = fileName[23:25] + '/'
# read DBL file with the help of the Matlab function provided by ESA
eng = matlab.engine.start_matlab() # start Matlab
DATA = eng.main_read(path_saveFilefromFTP + Path_year + Path_month + fileName) # run matlab script
eng.quit() # end Matlab
此代码已经 运行 在另一台电脑上,但遗憾的是在这台电脑上出现了错误。
我安装了好几次MATLAB Engine,结果都是一样的。根据调用的 futureresult.py
函数,timeout
是返回结果之前等待的秒数。但默认情况下,函数会等待,直到结果可用。因为那里似乎发生了错误,所以该函数无法提供结果。
未来结果解释如下:
An instance of FutureResult is returned from each asynchronous invocation of a
function call: start_matlab, connect_matlab, or MatlabEngine.. The
future result serves as a placeholder of the actual result, so the future
result can be returned immediately. The actual result is placed into the
placeholder when the function finishes its evaluation.
但是程序已经通过调用引擎MATLAB Engine停止了,所以应该是MATLAB和Python的连接有问题。
我在 Ubuntu 16.04 LTS 中使用 Python 3.6.5 和 Anaconda 5.2,并安装了 MATLAB 2018a。
更新:现在我在另一台电脑上测试,出现同样的错误。似乎它总是在我必须在这台电脑上激活 MATLAB 之后发生。所以我改了标题。
有人知道如何解决这个问题吗?
提前致谢!
经过多次测试,唯一的解决办法是删除MATLAB,然后重新安装。也许有更好的解决方案,但因为 MATLAB 需要激活,而且它已经激活,我猜是 MATLAB 许可证有问题,因此 MATLAB 没有响应 MATLAB 引擎。
我按照
Traceback (most recent call last):
File "<ipython-input-1-7f0848dd34ed>", line 1, in <module>
runfile('/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py', wdir='/media/geodasie/dat/Dennis/Python/PythonProgram')
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py", line 288, in <module>
eng = matlab.engine.start_matlab() # start Matlab
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/__init__.py", line 115, in start_matlab
eng = future.result()
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
EngineError: Transport stopped.
出现错误的代码序列是:
Path_year = fileName[19:23] + '/'
Path_month = fileName[23:25] + '/'
# read DBL file with the help of the Matlab function provided by ESA
eng = matlab.engine.start_matlab() # start Matlab
DATA = eng.main_read(path_saveFilefromFTP + Path_year + Path_month + fileName) # run matlab script
eng.quit() # end Matlab
此代码已经 运行 在另一台电脑上,但遗憾的是在这台电脑上出现了错误。
我安装了好几次MATLAB Engine,结果都是一样的。根据调用的 futureresult.py
函数,timeout
是返回结果之前等待的秒数。但默认情况下,函数会等待,直到结果可用。因为那里似乎发生了错误,所以该函数无法提供结果。
未来结果解释如下:
An instance of FutureResult is returned from each asynchronous invocation of a function call: start_matlab, connect_matlab, or MatlabEngine.. The future result serves as a placeholder of the actual result, so the future result can be returned immediately. The actual result is placed into the placeholder when the function finishes its evaluation.
但是程序已经通过调用引擎MATLAB Engine停止了,所以应该是MATLAB和Python的连接有问题。
我在 Ubuntu 16.04 LTS 中使用 Python 3.6.5 和 Anaconda 5.2,并安装了 MATLAB 2018a。
更新:现在我在另一台电脑上测试,出现同样的错误。似乎它总是在我必须在这台电脑上激活 MATLAB 之后发生。所以我改了标题。
有人知道如何解决这个问题吗?
提前致谢!
经过多次测试,唯一的解决办法是删除MATLAB,然后重新安装。也许有更好的解决方案,但因为 MATLAB 需要激活,而且它已经激活,我猜是 MATLAB 许可证有问题,因此 MATLAB 没有响应 MATLAB 引擎。