]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
Print a warning instead of raising an error when a product pyconf file cannot be...
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Tue, 17 Jan 2017 09:18:01 +0000 (10:18 +0100)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Tue, 17 Jan 2017 09:18:01 +0000 (10:18 +0100)
commands/config.py

index cb5863f35064746a10ffa60b93ec6ecabdf6d694..e3d0f9725c6bf167055429b12fb089523c603e64 100644 (file)
@@ -294,9 +294,11 @@ class ConfigManager:
                 project_cfg = src.pyconf.Config(open(project_pyconf_path),
                                                 PWD=("", project_pyconf_dir))
             except Exception as e:
-                raise src.SatException(_("Error in configuration file: "
-                                 "%(file_path)s\n  %(error)s") % \
-                            {'file_path' : project_pyconf_path, 'error': str(e) })
+                msg = _("WARNING: Error in configuration file: "
+                                 "%(file_path)s\n  %(error)s\n") % \
+                            {'file_path' : project_pyconf_path, 'error': str(e) }
+                sys.stdout.write(msg)
+                continue
             projects_cfg.PROJECTS.projects.addMapping(project_name,
                              src.pyconf.Mapping(projects_cfg.PROJECTS.projects),
                              "The %s project\n" % project_name)
@@ -361,17 +363,13 @@ class ConfigManager:
                                                     os.path.join(products_dir,
                                                                  fName)),
                                                      PWD=("", products_dir))
-                    except src.pyconf.ConfigError as e:
-                        raise src.SatException(_(
-                            "Error in configuration file: %(prod)s\n  %(error)s") % \
-                            {'prod' :  fName, 'error': str(e) })
-                    except IOError as error:
-                        e = str(error)
-                        raise src.SatException( e );
                     except Exception as e:
-                        raise src.SatException(_(
-                            "Error in configuration file: %(prod)s\n  %(error)s") % \
+                        msg = _(
+                            "WARNING: Error in configuration file"
+                            ": %(prod)s\n  %(error)s" % \
                             {'prod' :  fName, 'error': str(e) })
+                        sys.stdout.write(msg)
+                        continue
                     
                     products_cfg.PRODUCTS[pName] = prod_cfg