X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2Fpadder%2Fspadderpy%2Fconfigreader.py;h=f4c0b6b6d22c129bde708b96196d6f258d20e330;hb=7e3bbc4f0020fbcb51cd3e0d5bdb046b71019960;hp=0105404194068b828bf75d507e619c0dc752f3e4;hpb=1c3d4eccd17b112559ad4870a2a55a85f6a36b36;p=modules%2Fsmesh.git diff --git a/src/Tools/padder/spadderpy/configreader.py b/src/Tools/padder/spadderpy/configreader.py index 010540419..f4c0b6b6d 100644 --- a/src/Tools/padder/spadderpy/configreader.py +++ b/src/Tools/padder/spadderpy/configreader.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2011-2012 EDF R&D +# Copyright (C) 2011-2019 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,11 +17,12 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + # Author(s): Guillaume Boulant (23/03/2011) # import sys, os -import ConfigParser +import configparser from MESHJOB import ConfigParameter from salome.kernel.uiexception import AdminException, UiException @@ -41,7 +42,7 @@ class ConfigReader: self.__configFilename = None try: smeshpath=os.environ["SMESH_ROOT_DIR"] - except KeyError, ex: + except KeyError as ex: raise AdminException("You should define the variable SMESH_ROOT_DIR") pluginspath = os.path.join(smeshpath,CONFIG_RELPATH) @@ -52,11 +53,11 @@ class ConfigReader: msg = "The configuration file %s can't be found in the SMESH plugins path %s" raise AdminException(msg%(CONFIG_FILENAME,pluginspath)) - print "The configuration file is : %s"%self.__configFilename - self.__configparser = ConfigParser.RawConfigParser() + print("The configuration file is : %s"%self.__configFilename) + self.__configparser = configparser.RawConfigParser() try: self.__configparser.read(self.__configFilename) - except ConfigParser.ParsingError, ex: + except configparser.ParsingError as ex: raise AdminException(ex.message) def getLocalConfig(self): @@ -86,10 +87,10 @@ class ConfigReader: return defaultType def printConfig(config): - print "PADDER CONFIGURATION:" - print "\tconfig.resname = %s"%config.resname - print "\tconfig.binpath = %s"%config.binpath - print "\tconfig.envpath = %s"%config.envpath + print("PADDER CONFIGURATION:") + print("\tconfig.resname = %s"%config.resname) + print("\tconfig.binpath = %s"%config.binpath) + print("\tconfig.envpath = %s"%config.envpath) def getPadderTestDir(config): """ @@ -111,10 +112,10 @@ def TEST_getDefaultConfig(): try: configReader = ConfigReader() defaultConfig = configReader.getDefaultConfig() - print defaultConfig.resname - print defaultConfig.binpath - print defaultConfig.envpath - except Exception, ex: + print(defaultConfig.resname) + print(defaultConfig.binpath) + print(defaultConfig.envpath) + except Exception as ex: sys.stderr.write('ERROR: %s\n' % str(ex)) return False @@ -126,8 +127,8 @@ def TEST_getDefaultConfig_withError(): try: configReader = ConfigReader() defaultConfig = configReader.getDefaultConfig() - except UiException, err: - print 'ERROR: %s' % str(err) + except UiException as err: + print('ERROR: %s' % str(err)) return True return False