From 4bfc4a29a533cfb1685e4214ba53377dcf59fc92 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Sun, 26 May 2013 09:12:25 +0000
Subject: [PATCH] onelab python explicit pseudo-destructor (for code aster
 python)

---
 contrib/onelab/python/onelab.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/contrib/onelab/python/onelab.py b/contrib/onelab/python/onelab.py
index 61de45fd85..b658cf7f58 100755
--- a/contrib/onelab/python/onelab.py
+++ b/contrib/onelab/python/onelab.py
@@ -328,9 +328,14 @@ class client :
     self.action = self.getString('python/Action')
     self.setNumber('IsPyMetamodel',value=1,visible=0)
     if self.action == "initialize": exit(0)
-  
-  def __del__(self) :
-    self._wait_on_subclients()
+
+  def finalize(self) : #code aster python interpreter does not call the destructor at exit, it is necessary to call finalize() epxlicitely
     if self.socket :
+      self._wait_on_subclients()
       self._send(self._GMSH_STOP, 'Goodbye!')
       self.socket.close()
+      self.socket = None
+    
+  
+  def __del__(self) :
+    finalize()
-- 
GitLab