diff --git a/ChangeLog.txt b/ChangeLog.txt index 2f14a2f8..291a3631 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.4.4 - 31/12/2002 BugFixed: - AttributeError: 'PosixPath' object has no attribute 'startswith' +- KeyError: 'sbo_chglog_txt' #LQ post6401410 4.4.3 - 30/12/2022 Updated: diff --git a/slpkg/configs.py b/slpkg/configs.py index 5e85b832..780a3132 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -18,8 +18,8 @@ class LoadConfigs: if config_path_file.exists(): with open(config_path_file, 'rb') as conf: return tomli.load(conf) - except (KeyError, tomli.TOMLDecodeError) as error: - raise SystemExit(f"\nError: {error}: in the configuration file " + except tomli.TOMLDecodeError as error: + raise SystemExit(f"\nValueError: {error}: in the configuration file " "'/etc/slpkg/slpkg.toml'\n") @@ -73,38 +73,42 @@ class Configs: config = configs['configs'] if config: - # OS architecture by default - os_arch: str = config['os_arch'] + try: + # OS architecture by default + os_arch: str = config['os_arch'] - # All necessary paths - tmp_slpkg: str = config['tmp_slpkg'] - build_path: str = config['build_path'] - download_only: str = config['download_only'] - sbo_repo_path: str = config['sbo_repo_path'] + # All necessary paths + tmp_slpkg: str = config['tmp_slpkg'] + build_path: str = config['build_path'] + download_only: str = config['download_only'] + sbo_repo_path: str = config['sbo_repo_path'] - # Database name - database: str = config['database'] + # Database name + database: str = config['database'] - # SBo repository details - sbo_repo_url: str = config['sbo_repo_url'] - sbo_txt: str = config['sbo_txt'] - sbo_chglog_txt: str = config['sbo_chglog_txt'] - sbo_tar_suffix: str = config['sbo_tar_suffix'] - sbo_repo_tag: str = config['sbo_repo_tag'] + # SBo repository details + sbo_repo_url: str = config['sbo_repo_url'] + sbo_txt: str = config['sbo_txt'] + sbo_chglog_txt: str = config['sbo_chglog_txt'] + sbo_tar_suffix: str = config['sbo_tar_suffix'] + sbo_repo_tag: str = config['sbo_repo_tag'] - # Slackware commands - installpkg: str = config['installpkg'] - reinstall: str = config['reinstall'] - removepkg: str = config['removepkg'] + # Slackware commands + installpkg: str = config['installpkg'] + reinstall: str = config['reinstall'] + removepkg: str = config['removepkg'] - # Cli menu colors configs - colors: str = config['colors'] + # Cli menu colors configs + colors: str = config['colors'] - # Wget options - wget_options: str = config['wget_options'] + # Wget options + wget_options: str = config['wget_options'] - # Dialog utility - dialog: str = config['dialog'] + # Dialog utility + dialog: str = config['dialog'] + except KeyError as error: + raise SystemExit(f"\nKeyError: {error}: in the configuration file " + "'/etc/slpkg/slpkg.toml'\n") # Creating the paths if not exists paths = [tmp_slpkg,