When using Matlab engine from Python, process [matlab_helper] <defunct> is left as zombie process
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Venkat Siddarth Reddy
el 16 de En. de 2024
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?
Respuestas (1)
Varun
el 22 de En. de 2024
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”:
0 comentarios
Ver también
Categorías
Más información sobre Call MATLAB from Python en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!