[Erp5-report] r41928 gabriel - /erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Jan 2 19:58:30 CET 2011


Author: gabriel
Date: Sun Jan  2 19:58:30 2011
New Revision: 41928

URL: http://svn.erp5.org?rev=41928&view=rev
Log:
refactor code to prevent OSError exception and make possible retry the conversion

Modified:
    erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py?rev=41928&r1=41927&r2=41928&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/oohandler.py [utf8] Sun Jan  2 19:58:30 2011
@@ -90,12 +90,10 @@ class OOHandler:
     """start the Monitor"""
     self.monitor = MonitorTimeout(openoffice, self.timeout)
     self.monitor.start()
-    return
 
   def _stopTimeout(self):
     """stop the Monitor"""
     self.monitor.terminate()
-    return
 
   def _subprocess(self, command):
     """Run one procedure"""
@@ -107,10 +105,14 @@ class OOHandler:
                     stderr=PIPE,
                     close_fds=True)
       stdout, stderr = process.communicate()
+    except OSError, e:
+      self.monitor = process = None
+      stdout, stderr = "", "OSError: %s" % e
     finally:
-      self._stopTimeout()
-      if pid_exists(process.pid):
-        process.terminate()
+      if self.monitor is not None and process is not None:
+        self._stopTimeout()
+        if pid_exists(process.pid):
+          process.terminate()
     return stdout, stderr
 
   def _callUnoConverter(self, *feature_list, **kw):



More information about the Erp5-report mailing list