X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fomf%2Fapplication.py;h=03db08892ae220a49b3666d4fa771cd436b053ee;hb=6285ca51026efb69642eea9dfc7c480e722d84a9;hp=eef5297c49eeb1e99012e0961a1cd868eeabb690;hpb=e55924b6886bd7382a28e1ae235c4810f852e163;p=nepi.git diff --git a/src/nepi/resources/omf/application.py b/src/nepi/resources/omf/application.py index eef5297c..03db0889 100644 --- a/src/nepi/resources/omf/application.py +++ b/src/nepi/resources/omf/application.py @@ -17,6 +17,8 @@ # Author: Alina Quereilhac # Julien Tribino +from __future__ import print_function + import os from nepi.util.timefuncs import tnow @@ -200,7 +202,7 @@ class OMFApplication(OMFResource): if not self.get('xmppServer'): msg = "XmppServer is not initialzed. XMPP Connections impossible" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) if not (self.get('xmppUser') or self.get('xmppPort') or self.get('xmppPassword')): @@ -210,7 +212,7 @@ class OMFApplication(OMFResource): if not self.get('command') : msg = "Application's Command is not initialized" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) if not self._omf_api : self._omf_api = OMFAPIFactory.get_api(self.get('version'), @@ -242,7 +244,7 @@ class OMFApplication(OMFResource): if self._create_cnt > confirmation_counter: msg = "Couldn't retrieve the confirmation of the creation" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) uid = self.check_deploy(self.create_id) if not uid: @@ -284,13 +286,11 @@ class OMFApplication(OMFResource): if attr == TraceAttr.ALL: try: - f = open(trace_path ,'r') + with open(trace_path ,'r') as f: + return f.read() except IOError: - print "File with traces has not been found" + print("File with traces has not been found") return False - out = f.read() - f.close() - return out def do_start(self): @@ -331,7 +331,7 @@ class OMFApplication(OMFResource): if self._start_cnt > confirmation_counter: msg = "Couldn't retrieve the confirmation that the application started" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) res = self.check_start(self._topic_app) if not res: