]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
replace all usage of bare except clause with except Exception clause
authorGbkng <guillaume.brooking@gmail.com>
Wed, 14 Feb 2024 08:49:33 +0000 (09:49 +0100)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Mon, 4 Mar 2024 16:37:49 +0000 (17:37 +0100)
38 files changed:
.gitignore
AllTestLauncherSat.py
commands/application.py
commands/compile.py
commands/config.py
commands/generate.py
commands/jobs.py
commands/log.py
commands/package.py
commands/template.py
commands/test.py
data/local.pyconf [new file with mode: 0644]
data/templates/Application/config/splash_generator/splash2.py
data/templates/PythonComponent/src/PYCMP/PYCMP_utils.py
data/templates/PythonComponent8/src/PYCMP/PYCMP_utils.py
src/ElementTree.py
src/ElementTreePython2.py
src/ElementTreePython3.py
src/__init__.py
src/architecture.py
src/callerName.py
src/compilation.py
src/debug.py
src/environment.py
src/fork.py
src/loggingSimple.py
src/product.py
src/pyconf.py
src/returnCode.py
src/salomeTools.py
src/system.py
src/test/TOOLS.py
src/test_module.py
src/versionMinorMajorPatch.py
src/xmlManager.py
test/test_501_paramiko.py
test/test_sat5_0/log/test_launch_browser.py
test/test_sat5_0/prepare/test_prepare.py

index 5d2f22756a213de02b6e8d7ea881b45479c8a400..de154bf7a09956a0a81c7171419e1e2d079b49d0 100644 (file)
@@ -20,7 +20,4 @@ doc/src/commands/apidoc*
 __pycache__/
 
 # IDE/editors/tools cache files
-.vscode/
-
-# cache file, generated by sat, to store configuration
-data/local.pyconf
+.vscode/
\ No newline at end of file
index eaa1a967b5054a52b30297dfd3095c4ea38cc061..cf8319d96a0eebbc99c3801f22fe165dc404bf74 100755 (executable)
@@ -86,7 +86,7 @@ def errPrint(aStr):
 
 try:
   import unittestpy.HTMLTestRunner as HTST
-except:
+except Exception:
   HTST = None
   errPrint("""
 WARNING: no HTML output available.
@@ -96,7 +96,7 @@ WARNING: no HTML output available.
 
 try:
   import xmlrunner as XTST
-except:
+except Exception:
   XTST = None
   errPrint("""
 WARNING: no XML output available for unittest.
index 025baf3077a79443c5f4face376680e2bceaeb55..4015ff1c59b85d1ac67286dd0d964309138acc05 100644 (file)
@@ -155,7 +155,7 @@ def customize_app(config, appli_dir, logger):
         if text is not None:
             try:
                 n.text = text.strip("\n\t").decode("UTF-8")
-            except:
+            except Exception:
                 sys.stderr.write("################ %s %s\n" % (node_name, text))
                 n.text = "?"
         parent.append(n)
index 0368549d190ccd9cae968da2f54b9d2a3aec09b2..12cfbe6acf8e26d137571e30fc7939051684bed9 100644 (file)
@@ -230,7 +230,7 @@ def compile_all_products(sat, config, options, products_infos, all_products_dict
                                   batch=True,
                                   verbose=0,
                                   logger_add_link = logger)
-                except:
+                except Exception:
                     pass
 
     if check_salome_configuration:
@@ -547,7 +547,7 @@ def compile_product_pip(sat,
                                env=build_environ.environ.environ,
                                stderr=subprocess.STDOUT).decode(sys.stdout.encoding).strip()
         pip_build_options=int(res_pip_version.split('.')[0]) < 21
-    except:
+    except Exception:
         pip_build_options= True
     # d- install (in python or in separate product directory)
     if src.appli_test_property(config,"pip_install_dir", "python"):
index 6bb522cf6ddfa44614f85c86b4622b75e12c9fae..24a95a86d28ce25f05a20f7e3d9ec7396ab7c425 100644 (file)
@@ -22,7 +22,6 @@ import platform
 import datetime
 import shutil
 import gettext
-from pathlib import Path
 import pprint as PP
 
 import src
@@ -287,15 +286,9 @@ class ConfigManager:
         # Load LOCAL config file
         # search only in the data directory
         src.pyconf.streamOpener = ConfigOpener([cfg.VARS.datadir])
-
-        # if `local.pyconf` file is missing, create it from 
-        # `local_original.pyconf` template file
-        localconf_path = osJoin(cfg.VARS.datadir, 'local.pyconf')
-        if not Path(localconf_path).is_file():
-            shutil.copyfile(osJoin(cfg.VARS.datadir, 'local_original.pyconf'), localconf_path)
-
         try:
-            local_cfg = src.pyconf.Config(open(localconf_path),
+            local_cfg = src.pyconf.Config(open( osJoin(cfg.VARS.datadir,
+                                                           'local.pyconf')),
                                          PWD = ('LOCAL', cfg.VARS.datadir) )
         except src.pyconf.ConfigError as e:
             raise src.SatException(_("Error in configuration file: "
@@ -1075,7 +1068,7 @@ def get_config_children(config, args):
                 if dir(a).__contains__('keys'):
                     vals = map(lambda x: head + '.' + x,
                                [m for m in a.keys() if m.startswith(tail)])
-            except:
+            except Exception:
                 pass
 
     for v in sorted(vals):
index fbd08aa5e57271f44df9b46c69f58eab60b02141..a6a83ce33d3185d0086bd28920313aa8280d84f4 100644 (file)
@@ -147,7 +147,7 @@ def generate_component(config, compo, product_name, product_info, context, heade
             # get files to build a template GUI
             try: # try new yacsgen api
                 gui_files = salome_compo.getGUIfilesTemplate(compo)
-            except:  # use old yacsgen api
+            except Exception:  # use old yacsgen api
                 gui_files = salome_compo.getGUIfilesTemplate()
         else:
             gui_files = None
index c043d7048e094d8463f6f40b6f9f26b9a6c3c7dc..b948a74296c8a2743f0a2e07c5e8cfeb30f143f5 100644 (file)
@@ -30,7 +30,7 @@ import re
 # generate problem
 try:
   import paramiko
-except:
+except Exception:
   paramiko = "import paramiko impossible"
   pass
 
@@ -114,7 +114,7 @@ class Machine(object):
         except paramiko.SSHException:
             message = ( _("SSHException error connecting or "
                           "establishing an SSH session"))            
-        except:
+        except Exception:
             message = ( _("Error connecting or establishing an SSH session"))
         else:
             self._connection_successful = True
@@ -215,7 +215,7 @@ class Machine(object):
                             ": the server failed to execute the command\n")
             logger.write( src.printcolors.printcError(message))
             return (None, None, None)
-        except:
+        except Exception:
             logger.write( src.printcolors.printcError(src.KO_STATUS + '\n'))
             return (None, None, None)
         else:
@@ -327,7 +327,7 @@ class Job(object):
         '''
         try:
             pids = self.get_pids()
-        except:
+        except Exception:
             return ("Unable to get the pid of the command.", "")
             
         cmd_kill = " ; ".join([("kill -2 " + pid) for pid in pids])
index 22a788570fc8fa85895c4ea82891a55e1b865ba6..fbdbaad8d5ca2d695b3b51bf9cd371fb3864d2ac 100644 (file)
@@ -181,7 +181,7 @@ def ask_value(nb):
             x = int(rep)
             if x > nb:
                 x = -1
-    except:
+    except Exception:
         x = -1
     
     return x
@@ -269,7 +269,7 @@ def run(args, runner, logger):
       src.ensure_path_exists(os.path.join(logDir, "TEST"))
       shutil.copy(xsltest, os.path.join(logDir, "TEST"))
       shutil.copy(imgLogo, logDir)
-    except:
+    except Exception:
       # we are here  if an user make sat log in jenkins LOGS without write rights
       # Make a warning and do nothing
       logger.warning("problem for writing in directory '%s', may be not owner." % logDir)
@@ -338,7 +338,7 @@ def run(args, runner, logger):
                               notShownCommands = notShownCommands)
 
       logger.write(src.printcolors.printc("OK"), 3)
-    except:
+    except Exception:
       logger.write(src.printcolors.printc("KO"), 3)
       logger.write(" problem update hat.xml", 3)
 
index f91476e2d6b6b87c7027b2a4ba37431b0af6de62..c5ffbfffbd9fa811dc8d329639e9c3e858fd49df 100644 (file)
@@ -385,7 +385,7 @@ def hack_for_distene_licence(filepath, licence_file):
             import imp
             distene = imp.load_source('distene_licence', distene_licence_file)
         distene.set_distene_variables(context)
-    except:
+    except Exception:
         pass\n"""  % licence_file
     text.insert(num_line + 1, text_to_insert)
     for line in text:
@@ -948,7 +948,7 @@ def source_package(sat, config, logger, options, tmp_working_dir):
     if not src.architecture.is_windows():
         try:
             t = os.getcwd()
-        except:
+        except Exception:
             # In the jobs, os.getcwd() can fail
             t = config.LOCAL.workdir
         os.chdir(tmp_working_dir)
@@ -1447,7 +1447,7 @@ def project_package(config, name_project, project_file_path, ftp_mode, tmp_worki
 
     try:
       project_pyconf_cfg = config.PROJECTS.projects.__getattr__(name_project)
-    except:
+    except Exception:
       logger.write("""
 WARNING: inexisting config.PROJECTS.projects.%s, try to read now from:\n%s\n""" % (name_project, project_file_path))
       project_pyconf_cfg = src.pyconf.Config(project_file_path)
@@ -1899,7 +1899,7 @@ Please add it in file:
     # case if no application, only package sat as 'sat package -t'
     try:
         app = runner.cfg.APPLICATION
-    except:
+    except Exception:
         app = None
 
     # unconditionaly remove the tmp_local_working_dir
index e4ddc59677672ec65b8130cd0f57eff046c6248d..cdc1c8165e93d3991457027f88c58ea051c5500c 100644 (file)
@@ -35,7 +35,7 @@ except NameError:
 # Python 2/3 compatibility for execfile function
 try:
     execfile
-except:
+except Exception:
     def execfile(somefile, global_vars, local_vars):
         with open(somefile) as f:
             code = compile(f.read(), somefile, 'exec')
index 62fd7fef5cc6d55e793a4955b2dc6bde2f4ebc72..cac9b4c5227c3abfd8f99cf135eb33f184698409 100644 (file)
@@ -174,7 +174,7 @@ def move_test_results(in_dir, what, out_dir, logger):
                 #shutil.rmtree(finalPath)
                 os.makedirs(finalPath)
             pathIsOk = True
-        except:
+        except Exception:
             logger.error(_("%s cannot be created.") % finalPath)
             finalPath = ask_a_path()
 
@@ -664,7 +664,7 @@ def run(args, runner, logger):
     if os.access(tmp_dir, os.F_OK):
         try:
             shutil.rmtree(tmp_dir)
-        except:
+        except Exception:
             logger.error(_("error removing TT_TMP_RESULT %s\n") 
                                 % tmp_dir)
 
diff --git a/data/local.pyconf b/data/local.pyconf
new file mode 100644 (file)
index 0000000..eb81d5a
--- /dev/null
@@ -0,0 +1,16 @@
+  
+  LOCAL :
+  {
+    base : 'default'
+    workdir : 'default'
+    log_dir : 'default'
+    archive_dir : 'default'
+    VCS : 'unknown'
+    tag : 'unknown'
+  }
+  PROJECTS :
+  {
+    project_file_paths :
+    [
+    ]
+  }
index 1521075b8d14de1e4e9c23ebb3eb1df0240426c8..8c9e3cdc91e9cb6f01bc306ab75e7667d3fabe5e 100755 (executable)
@@ -9,7 +9,7 @@ import os, sys
 
 try:
   __LANG__ = os.environ["LANG"] # original locale
-except:
+except Exception:
   __LANG__ = "en_US.utf8" #default
 
 __FR__={
@@ -27,7 +27,7 @@ def _loc(text):
   if "FR" in __LANG__:
     try:
       return __FR__[text]
-    except:
+    except Exception:
       return text
   return text
 
index 56e155787b66ba1cd434368deb74a3edd722aa5f..da4f92b2a50df5d2b79a81703409d99c3af3a95d 100755 (executable)
@@ -88,7 +88,7 @@ def verbose():
     if __verbose__ is None:
         try:
             __verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) )
-        except:
+        except Exception:
             __verbose__ = 0
             pass
         pass
@@ -177,7 +177,7 @@ def findOrCreateComponent( study ):
         try:
             builder.DefineComponentInstance( father, getEngine() )
             pass
-        except:
+        except Exception:
             pass
         pass
     return father
index 56e155787b66ba1cd434368deb74a3edd722aa5f..da4f92b2a50df5d2b79a81703409d99c3af3a95d 100755 (executable)
@@ -88,7 +88,7 @@ def verbose():
     if __verbose__ is None:
         try:
             __verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) )
-        except:
+        except Exception:
             __verbose__ = 0
             pass
         pass
@@ -177,7 +177,7 @@ def findOrCreateComponent( study ):
         try:
             builder.DefineComponentInstance( father, getEngine() )
             pass
-        except:
+        except Exception:
             pass
         pass
     return father
index b871200f6461694aa6ff92d2fa83ab6bf8576130..65c63c9fe65f979be6b91a8d9121b460f22c14dd 100644 (file)
@@ -30,7 +30,7 @@ else:
     """
     try:
       aStr = etree.tostring(node, encoding='unicode', method="pretty_xml")
-    except:
+    except Exception:
       print("*****************************\n problem node", node)
       # try no pretty
       aStr = etree.tostring(node, encoding='unicode')
index d1ba909381f358c50b07e5852dde728708176723..4b31874cd939a618ff8ec61060b1c02b1a674b9e 100644 (file)
@@ -700,7 +700,7 @@ class ElementTree:
             if items or xmlns_items:
                 try:
                     items = sorted(items) # lexical order
-                except:
+                except Exception:
                     print("*** problem sorting items", items)
                 for k, v in items:
                     try:
@@ -1086,7 +1086,7 @@ class TreeBuilder:
                 for item in self._data:
                     try:
                         text += item
-                    except:
+                    except Exception:
                         text += item.decode()
                 if self._tail:
                     assert self._last.tail is None, "internal error (tail)"
@@ -1292,7 +1292,7 @@ class XMLTreeBuilder:
         """
         try:
             self._parser.Parse(data, 0)
-        except:
+        except Exception:
             print("*** problem feed:\n%s" % data.decode('utf-8'))
 
     ##
index 68635ce6d819df15a5a0f14af2f1164947dbab72..74adb5d9c0a6d275ebfcae96b02e16fb3e159acd 100644 (file)
@@ -1266,7 +1266,7 @@ def iterparse(source, events=None, parser=None):
         close_source = True
     try:
         return _IterParseIterator(source, events, parser, close_source)
-    except:
+    except Exception:
         if close_source:
             source.close()
         raise
@@ -1365,7 +1365,7 @@ class _IterParseIterator:
                 else:
                     self._root = self._parser._close_and_return_root()
             self.root = self._root
-        except:
+        except Exception:
             if self._close_file:
                 self._file.close()
             raise
index 9f3e8d1e7a2fc26019dbee57d82f3ecee2954470..34aecded29620c8f1963250647320405a158703e 100644 (file)
@@ -403,14 +403,14 @@ class Path:
         try:
             os.symlink(str(path), self.path)
             return True
-        except:
+        except Exception:
             return False
 
     def copylink(self, path):
         try:
             os.symlink(os.readlink(self.path), str(path))
             return True
-        except:
+        except Exception:
             return False
 
     def copydir(self, dst, smart=False):
@@ -429,14 +429,14 @@ class Path:
                 dstname = dst + name
                 srcname.copy(dstname, smart)
             return True
-        except:
+        except Exception:
             return False
 
     def copyfile(self, path):
         try:
             shutil.copy2(self.path, str(path))
             return True
-        except:
+        except Exception:
             return False
 
 def find_file_in_lpath(file_name, lpath, additional_dir = ""):
@@ -507,7 +507,7 @@ def find_file_in_ftppath(file_name, ftppath, installation_dir, logger, additiona
                ftp.cwd(directory)
            if additional_dir:
                ftp.cwd(additional_dir)
-       except:
+       except Exception:
            logger.error("while connecting to ftp server %s\n" % ftp_server)
            continue
 
@@ -517,7 +517,7 @@ def find_file_in_ftppath(file_name, ftppath, installation_dir, logger, additiona
            if ftp.size(file_name_md5) > 0:
                with open(destination_md5,'wb') as dest_file_md5:
                    ftp.retrbinary("RETR "+file_name_md5, dest_file_md5.write)
-       except:
+       except Exception:
            pass
 
        try:
@@ -527,7 +527,7 @@ def find_file_in_ftppath(file_name, ftppath, installation_dir, logger, additiona
                    ftp.retrbinary("RETR "+file_name, dest_file.write)
                logger.write("   Archive %s was retrieved and stored in %s\n" % (file_name, destination), 3)
                return destination
-       except:
+       except Exception:
            logger.error("File not found in ftp_archive %s\n" % ftp_server)
 
     return False
index 6e83d0beeea8dcb950ea3f9cd0c98dba03cd7e8d..ad06c80e9ef6b819c62652dead451892a8f6498a 100644 (file)
@@ -29,10 +29,10 @@ from platform import system,python_version,release
 # write an error message if distro is not installed
 try:
     from platform import linux_distribution
-except:
+except Exception:
     try:
         from distro import linux_distribution
-    except:
+    except Exception:
         print ("\nError :\n"
                "  linux_distribution was removed from platform module in Python 3.8+\n"
                "  For python 3.8+ sat requires distro module to get information on linux distribution.\n"
@@ -59,7 +59,7 @@ def get_user():
         else: # linux
             import pwd
             user_name=pwd.getpwuid(os.getuid())[0]
-    except :
+    except Exception:
         user_name="Unknown"
     return user_name
 
@@ -160,7 +160,7 @@ def get_nb_proc():
     try :
         import multiprocessing
         nb_proc=multiprocessing.cpu_count()
-    except :
+    except Exception:
         if is_windows():
             if os.environ.has_key("NUMBER_OF_PROCESSORS"):
                 nb_proc = int(os.environ["NUMBER_OF_PROCESSORS"])
index 9fd0308f8088e21f9afb4a4ac65476a27e174db9..33df6ceb87387dd36523331eb53eda9fdbf1f7ff 100644 (file)
@@ -116,7 +116,7 @@ def caller_name_stack(skip=1):
       if namesrc == "__main__":
         namesrc = os.path.basename(fr.f_globals["__file__"])
       lineno.insert(0, (namesrc + "[%s]" % fr.f_lineno))
-    except:
+    except Exception:
       lineno.insert(0, ("??", fr.f_lineno))
 
   if codename != '<module>':  # top level usually
index 751fe73b911891c94f4de45f3fa9d46768d169be..b8e84bdbbcf96e4fa94e2b2348f1e1cd5410b319 100644 (file)
@@ -440,7 +440,7 @@ CC=\\"hack_libtool\\"%g" libtool'''
             pymodule = imp.load_source(product + "_compile_script", script)
             self.nb_proc = nb_proc
             retcode = pymodule.compil(self.config, self, self.logger)
-        except:
+        except Exception:
             __, exceptionValue, exceptionTraceback = sys.exc_info()
             self.logger.write(str(exceptionValue), 1)
             import traceback
index 330fb6df37c33468237c5c49f03f4e04528161b4..da1ca94ff7e0923a8c74e3abeb93204915d9e3d0 100755 (executable)
@@ -61,7 +61,7 @@ import src
 # Compatibility python 2/3 for unicode
 try:
     _test = unicode
-except:
+except Exception:
     unicode = str
 
 # Compatibility python 2/3 for StringIO
@@ -272,7 +272,7 @@ def _saveConfigRecursiveDbg(config, aStream, indent, path, nb):
     try: #type config, mapping
       order = object.__getattribute__(config, 'order')
       data = object.__getattribute__(config, 'data')
-    except:
+    except Exception:
       aStream.write("%s%s : '%s'\n" % (indstr, path, str(config)))
       return     
     for key in sorted(data): #order): # data as sort alphabetical, order as initial order
index a706d5deab31149f876575522860b92198d41b46..74e6bbdd2106f6ede15163a074b1889472e37e29 100644 (file)
@@ -321,7 +321,7 @@ class SalomeEnviron:
         for k in self.environ.environ.keys():
             try:
                 value = self.get(k)
-            except:
+            except Exception:
                 value = "?"
             out.write("%s=%s\n" % (k, value))
 
@@ -743,7 +743,7 @@ class SalomeEnviron:
                 # not mandatory, if set_nativ_env not defined, we do nothing
                 if "set_nativ_env" in dir(pyproduct):
                     pyproduct.set_nativ_env(self)
-        except:
+        except Exception:
             __, exceptionValue, exceptionTraceback = sys.exc_info()
             print(exceptionValue)
             import traceback
index aa239de9a05581797fa8d08ea04959a210e59e7f..e4492f04cdb1b5edf5a7f36591f69a2608313e84 100644 (file)
@@ -131,7 +131,7 @@ def batch_salome(cmd, logger, cwd, args, getTmpDir,
             try:
                 statinfo = os.stat(os.path.join(tmp_dir, file_name))
                 currentTime = statinfo.st_mtime
-            except:
+            except Exception:
                 pass
 
             if currentTime and currentTime > beginTime:
index 177b3426f2bf67dea058be8d2933518fc663c6dd..ddbb0b78ba6a67b343760edb59dea979ead905bd 100755 (executable)
@@ -377,7 +377,7 @@ class StreamHandlerSimple(LOGI.StreamHandler, object): # object force new-style
       self.flush()
     except (KeyboardInterrupt, SystemExit):
       raise
-    except:
+    except Exception:
       self.handleError(record)
 
 
index a679e44817d9d767140fbeb15f83076b0ed1fe5c..091ffe2d188093c0d42f493291ff5f2fd8395e7d 100644 (file)
@@ -355,7 +355,7 @@ Please provide a 'compil_script' key in its definition.""") % product_name
                                        "prod_name" : prod_info.name}) 
                       raise src.SatException(msg)
               patches.append(patch_path)
-        except:
+        except Exception:
           DBG.tofix("problem in prod_info.patches", prod_info)
         prod_info.patches = patches
 
@@ -425,7 +425,7 @@ def get_product_section(config, product_name, version, section=None):
     # decode version number
     try:
       versionMMP = VMMP.MinorMajorPatch(version)
-    except: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
+    except Exception: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
       versionMMP = None
 
     # if a section is explicitely specified we select it
@@ -666,7 +666,7 @@ def add_compile_config_file(p_info, config):
     try:
       with open(aFile, 'w') as f:
         p_info.__save__(f, evaluated=True) # evaluated expressions mode
-    except:
+    except Exception:
       # sometime some information cannot be evaluated.
       # for example, in the context of non VCS archives, information on git server is not available.
       DBG.write("Warning : sat was not able to evaluate and write down some information in file %s" % aFile)
@@ -829,7 +829,7 @@ def get_products_list(options, cfg, logger):
               else:
                 res.append((p_name, p_info))
                 ok.append(p_name)
-            except:
+            except Exception:
               res.append((p_name, p_info))
               ok.append(p_name)
       else:
@@ -840,7 +840,7 @@ def get_products_list(options, cfg, logger):
                 ok.append(p_name)
               else:
                 ko.append(p_name)
-            except:
+            except Exception:
               ko.append(p_name)
 
       if len(ok) != len(resAll):
index 5957d6ddcf8a12cbe2d5d971bf3eac266ca50ada..d19b5776c421d7c92ef1828598c1816e195f7e5e 100644 (file)
@@ -155,7 +155,7 @@ else:
 
 try:
     has_utf32 = True
-except:
+except Exception:
     has_utf32 = False
 
 class ConfigInputStream(object):
@@ -951,7 +951,7 @@ class Reference(object):
                         rv = eval(str(self)[1:-1], vars(ns))
                         found = True
                         break
-                    except:
+                    except Exception:
                         pass
                 if found:
                     break
@@ -963,7 +963,7 @@ class Reference(object):
                         key = item[1]
                         rv = rv[key]
                     break
-                except:
+                except Exception:
                     rv = None
                     pass
             current = object.__getattribute__(current, 'parent')
@@ -1632,13 +1632,13 @@ class ConfigMerger(object):
                             continue
                         try:
                             exec( 'map1.' + key + " = " + repr(overwrite_instruction[key]))
-                        except:
+                        except Exception:
                             exec('map1.' + key + " = " + str(overwrite_instruction[key]))
             else:
                 for key in overwrite_instruction.keys():
                     try:
                         exec('map1.' + key + " = " + repr(overwrite_instruction[key]))
-                    except:
+                    except Exception:
                         exec('map1.' + key + " = " + str(overwrite_instruction[key]))
 
     def mergeMapping(self, map1, map2):
index 1af9116677d72a9969a3b197376751e66d925140..240eb6332ce797a73404b5dfa011da95225723d5 100644 (file)
@@ -148,7 +148,7 @@ class ReturnCode(object):
     """return system return code as bash or bat"""
     try:
       return self._TOSYS[self._status]
-    except:
+    except Exception:
       return self._TOSYS[self.NA_STATUS]
 
   def toXmlPassed(self):
index a49524b24c465199efc051015dc06bed564dd2f7..2b1a50d442a1b9c3706346f7dbd0fbeb517f0d97 100755 (executable)
@@ -67,7 +67,7 @@ gettext.install("salomeTools", os.path.join(srcdir, "i18n"))
 
 try:
   _LANG = os.environ["LANG"] # original locale
-except:
+except Exception:
   _LANG = "en_US.utf8" #default
 
 # The possible hooks : 
@@ -356,7 +356,7 @@ class Sat(object):
                     sys.stderr = ff
                     import paramiko
                     sys.stderr = saveout
-                except:
+                except Exception:
                     sys.stderr = saveout
                     continue
 
index acb6feaef88bb8002125fb989b86899c77f38aad..cc500d0f5862ff3886a20e65309c9ef57687125a 100644 (file)
@@ -53,7 +53,7 @@ def show_in_editor(editor, filePath, logger):
         logger.write('Launched command:\n' + cmd + '\n', 5)
         p = SP.Popen(cmd, shell=True)
         p.communicate()
-    except:
+    except Exception:
         logger.write(printcolors.printcError(_("Unable to edit file %s\n") 
                                              % filePath), 1)
 
@@ -444,7 +444,7 @@ def check_system_pkg(check_cmd,pkg):
         try:
             output = SP.check_output(['grep', pkg], stdin=p.stdout)
             msg_status=src.printcolors.printcSuccess("OK")
-        except:
+        except Exception:
             msg_status=src.printcolors.printcError("KO")
             msg_status+=" (package is not installed!)\n"
     elif check_cmd[0] == "dpkg-query":
index 64b4b11c402da21c7c019b13298be6e803190e1c..7e2b9e104cac8fa06d8ec3ededc87a88dd4f2f8d 100644 (file)
@@ -90,7 +90,7 @@ def compMED(file1, file2, tol=0, diff_flags=""):
                 try:
                     line.index('Universal name of mesh')
                     continue
-                except:
+                except Exception:
                     dumpfile.write(line.replace(med, 'filename'))
         return dump
 
index 03c7b5810943500cefa86a2b459fed78860e2f35..218ba182e1073ff4afb26afbefe335ae6da7fc34 100644 (file)
@@ -19,7 +19,7 @@
 # Python 2/3 compatibility for execfile function
 try:
     execfile
-except:
+except Exception:
     def execfile(somefile, global_vars, local_vars):
         with open(somefile) as f:
             code = compile(f.read(), somefile, 'exec')
@@ -354,12 +354,12 @@ class Test:
                   if 'time' in ldic:
                       try:
                           exec_time = float(ldic['time'])
-                      except:
+                      except Exception:
                           pass
 
                   results[test] = [status, exec_time, callback, expected]
 
-                except:
+                except Exception:
                   results[test] = ["?", -1, "", []]
                   # results[test] = [src.O_STATUS, -1, open(resfile, 'r').read(), []]
 
@@ -484,7 +484,7 @@ echo -e 'import os\nprint(os.environ[\"KERNEL_ROOT_DIR\"])' > tmpscript.py
         try:
             grid = imp.load_module(sal_uts, file_, pathname, description)
             return grid.getLogDir
-        except:
+        except Exception:
             grid = imp.load_module(sal_uts, file_, pathname, description)
             return grid.getTmpDir
         finally:
index a8df9545c1f84dd954fb3da96b5b89660b9daed9..e7d87319c4eacbc2cb096ad10a1632fa5ae32131 100755 (executable)
@@ -90,7 +90,7 @@ def toList_majorMinorPatch(aStr, verbose=False):
 
   try:
     ii = int(res[0])
-  except:
+  except Exception:
     msg = "major in major_minor_patch is not integer: '%s'" % aStr
     raise Exception(msg)
   if ii < 0:
@@ -99,7 +99,7 @@ def toList_majorMinorPatch(aStr, verbose=False):
 
   try:
     ii = int(res[1])
-  except:
+  except Exception:
     msg = "minor in major_minor_patch is not integer: '%s'" % aStr
     raise Exception(msg)
   if ii < 0:
@@ -108,7 +108,7 @@ def toList_majorMinorPatch(aStr, verbose=False):
 
   try:
     ii = int(res[2])
-  except:
+  except Exception:
     msg = "patch in major_minor_patch is not integer: '%s'" % aStr
     raise Exception(msg)
   if ii < 0:
@@ -186,7 +186,7 @@ def getRange_majorMinorPatch(aStr, verbose=False):
   try:
     rMin = MinorMajorPatch(aMin)
     rMax = MinorMajorPatch(aMax)
-  except:
+  except Exception:
     msg = "problem version range in '%s'" % aStr
     raise Exception(msg)
     """if verbose:
index 6a4bb660eebf4ec231cedc40f0b753724116654a..8f7f28e250aa8839ff43ff5e5ffd16f1a8d64e29 100644 (file)
@@ -23,7 +23,7 @@ try: # For python2
     import sys
     reload(sys)  
     sys.setdefaultencoding('utf8')
-except:
+except Exception:
     pass
 
 import src
index ab5f92ba9d935662f267541714102715ecfbca48..3b0c7fb0d4639ddd3e9f07fe5751a50529b7c73e 100755 (executable)
@@ -161,7 +161,7 @@ class TestCase(unittest.TestCase):
 
     try:
       import paramiko as PK
-    except:
+    except Exception:
       print("\nproblem 'import paramiko', no tests")
       return
 
index a9c8be45cd5790f2615bc1d3f9bd2af05abbfd63..c06bddf3954b03c191555fe8c5ec854e5583c913 100755 (executable)
@@ -64,7 +64,7 @@ class TestCase(unittest.TestCase):
             sat.log('-t')
             OK = "OK"
             sys.stdin = sys.__stdin__
-        except:
+        except Exception:
             sys.stdin = sys.__stdin__
         self.assertEqual(OK, "OK")
 
@@ -84,7 +84,7 @@ class TestCase(unittest.TestCase):
             sat.log('appli-test -t --last')
             OK = "OK"
             sys.stdin = sys.__stdin__
-        except:
+        except Exception:
             pass
         self.assertEqual(OK, "OK")
 
index 334054772909d6c934b4013c23abcdbc871cb46c..d6779a8c3ac29ccf2201e96da2ccbd43bff9b105 100755 (executable)
@@ -91,7 +91,7 @@ class TestCase(unittest.TestCase):
         try:
             sat.prepare(appli + " --force --force_patch")
             OK = 'OK'
-        except:
+        except Exception:
             pass
         self.assertEqual(OK, 'OK')