From 98b11362fe1eb8590d3099514db2ac554af7cd98 Mon Sep 17 00:00:00 2001 From: DavidoTek <54072917+DavidoTek@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:54:19 +0100 Subject: [PATCH] Steamutil: Do not raise error in get_steam_vdf_compat_tool_mapping (#478) * steamutil: Do not raise an error in get_stream_vdf_compat_tool_mapping * steamutil: Improve error messages --- pupgui2/steamutil.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pupgui2/steamutil.py b/pupgui2/steamutil.py index 7d1db8d1..9b2b3665 100644 --- a/pupgui2/steamutil.py +++ b/pupgui2/steamutil.py @@ -24,14 +24,15 @@ _cached_steam_ctool_id_map = None -def get_steam_vdf_compat_tool_mapping(vdf_file: dict): +def get_steam_vdf_compat_tool_mapping(vdf_file: dict) -> dict: s = vdf_file.get('InstallConfigStore', {}).get('Software', {}) # Sometimes the key is 'Valve', sometimes 'valve', see #226 c = s.get('Valve') or s.get('valve') if not c: - raise KeyError('Error! config.vdf InstallConfigStore.Software neither contains key "Valve" nor "valve" - config.vdf file may be invalid!') + print('Error! config.vdf InstallConfigStore.Software neither contains key "Valve" nor "valve" - config.vdf file may be invalid!') + return {} m = c.get('Steam', {}).get('CompatToolMapping', {}) @@ -88,7 +89,7 @@ def get_steam_app_list(steam_config_folder: str, cached=False, no_shortcuts=Fals apps = update_steamapp_info(steam_config_folder, apps) apps = update_steamapp_awacystatus(apps) except Exception as e: - print('Error: Could not get a list of all Steam apps:', e) + print('Error (get_steam_app_list): Could not get a list of all Steam apps:', e) else: if not no_shortcuts: apps.extend(get_steam_shortcuts_list(steam_config_folder, c)) @@ -144,7 +145,7 @@ def get_steam_shortcuts_list(steam_config_folder: str, compat_tools: dict=None) app.compat_tool = ct.get('name') apps.append(app) except Exception as e: - print('Error: Could not get a list of Steam shortcut apps:', e) + print('Error (get_steam_shortcuts_list): Could not get a list of Steam shortcut apps:', e) return apps @@ -765,7 +766,7 @@ def get_steam_user_list(steam_config_folder: str) -> List[SteamUser]: users.append(user) except Exception as e: - print('Error: Could not get a list of Steam users:', e) + print('Error (get_steam_user_list): Could not get a list of Steam users:', e) return users