From: Serge Rehbinder Date: Tue, 17 Jan 2017 09:18:01 +0000 (+0100) Subject: Print a warning instead of raising an error when a product pyconf file cannot be... X-Git-Tag: 5.0.0a1~38^2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40c4ff7fb1ca2c6ea30a024026540af14af83622;p=tools%2Fsat.git Print a warning instead of raising an error when a product pyconf file cannot be read. --- diff --git a/commands/config.py b/commands/config.py index cb5863f..e3d0f97 100644 --- a/commands/config.py +++ b/commands/config.py @@ -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