From 295fc15efe56ea536bc676d32b52f0a19f636716 Mon Sep 17 00:00:00 2001 From: Nicolas Geimer Date: Wed, 19 Jul 2017 11:48:27 +0200 Subject: [PATCH] [Python 3] Minor fixes --- bin/launchConfigureParser.py | 5 +++-- src/Container/SALOME_Container.py | 1 - src/Container/SALOME_PyNode.py | 6 +++--- src/SALOMESDS/TestSalomeSDSHelper0.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index f5331d5d5..afe604591 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -111,8 +111,9 @@ def version(): if root_dir and os.path.exists( version_file ): filename = version_file if filename: - str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" - match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) + with open(filename, "r") as f: + v = f.readline() # v = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" + match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', v ) if match : return match.group( 1 ) except: diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 08ca5cd93..901f678a0 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -34,7 +34,6 @@ import os import sys -import string import traceback import imp from omniORB import CORBA, PortableServer diff --git a/src/Container/SALOME_PyNode.py b/src/Container/SALOME_PyNode.py index 62cf5906f..64ba69239 100644 --- a/src/Container/SALOME_PyNode.py +++ b/src/Container/SALOME_PyNode.py @@ -24,7 +24,7 @@ # Module : SALOME # $Header$ # -import sys,traceback,string +import sys,traceback import linecache import pickle import Engines__POA @@ -58,7 +58,7 @@ class PyNode_i (Engines__POA.PyNode,Generic): self.nodeName=nodeName self.code=code self.my_container=my_container._container - linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName + linecache.cache[nodeName]=0,None,code.split('\n'),nodeName ccode=compile(code,nodeName,'exec') self.context={} self.context["my_container"] = self.my_container @@ -97,7 +97,7 @@ class PyScriptNode_i (Engines__POA.PyScriptNode,Generic): self.nodeName=nodeName self.code=code self.my_container=my_container._container - linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName + linecache.cache[nodeName]=0,None,code.split('\n'),nodeName self.ccode=compile(code,nodeName,'exec') self.context={} self.context["my_container"] = self.my_container diff --git a/src/SALOMESDS/TestSalomeSDSHelper0.py b/src/SALOMESDS/TestSalomeSDSHelper0.py index 87065447f..7e447a8c4 100644 --- a/src/SALOMESDS/TestSalomeSDSHelper0.py +++ b/src/SALOMESDS/TestSalomeSDSHelper0.py @@ -23,4 +23,4 @@ def waitKey(): return str2Obj(dss.waitForMonoThrRev(wk))==[11,14,100] if __name__=="__main__": - sys.exit(not int(waitKey())) + sys.exit(not waitKey()) -- 2.39.2