フィルターのクリア

When using Matlab engine from Python, process [matlab_helper] <defunct> is left as zombie process

24 ビュー (過去 30 日間)
Jani
Jani 2024 年 1 月 10 日
回答済み: Varun 2024 年 1 月 22 日
0.0 0.0 0 0 ? Zs 10:16 0:00 [matlab_helper] <defunct>
When I look at processes after using eng.quit() in Python, those are left behind.
I am using release 2022b.
  1 件のコメント
Venkat Siddarth Reddy
Venkat Siddarth Reddy 2024 年 1 月 16 日
Hi Jani,
This situtation usually occurs if the MATLAB process is terminated unexpectedly or if its not properly closed by the python script.
A defunct process is one that has completed execution but still has an entry in the process table.This is usually sporadic in nature.
Can you please confirm whether this issue is repeating, even in the new session of python?

サインインしてコメントする。

回答 (1 件)

Varun
Varun 2024 年 1 月 22 日
Hi Jani,
Looks like you are not able successfully terminate the MATLAB process while using MATLAB engine for Python.
Make sure there are no unhandled exceptions occurring before or after the eng.quit() call. If an exception occurs, the quit() method might not be reached, leaving the MATLAB process running. Please refer the following example which has additional try-except block ensuring any errors during the quit() call are caught and printed, helping to identify potential issues.
import matlab.engine
try:
eng = matlab.engine.start_matlab()
# Your MATLAB commands here
except Exception as e:
print(f"Error: {e}")
finally:
try:
eng.quit()
except Exception as e:
print(f"Error during quit(): {e}")
You can also try using “eng.exit()” instead of “eng.quit()”, and see if it resolves the issue.
Please refer the following documentation to learn more about “Start and Stop MATLAB Engine for Python”:

カテゴリ

Help Center および File ExchangeCall MATLAB from Python についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by