From 9b4e4d2950510bc4592cafbb021be98a1882558e Mon Sep 17 00:00:00 2001 From: Michael Moore <5983927+MichaelMakesGames@users.noreply.github.com> Date: Fri, 10 May 2024 16:52:22 -0500 Subject: [PATCH] Fix loading loc files on Windows; change some mod errors to warns (#146) --- stellarisdashboard/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stellarisdashboard/config.py b/stellarisdashboard/config.py index d9df2a4..2d45c17 100644 --- a/stellarisdashboard/config.py +++ b/stellarisdashboard/config.py @@ -428,8 +428,8 @@ def game_data_dirs(self): if mod_data_path is not None ] except Exception as e: - logger.error(f"Failed to read enabled mods {dlc_load_path}") - logger.error(e) + logger.warn(f"Failed to read enabled mods from {dlc_load_path}. Using only base game data.") + logger.warn(e) return [self.stellaris_install_path] @property @@ -460,13 +460,13 @@ def _get_mod_data_dir(mod_descriptor_path: pathlib.Path): if match: return pathlib.Path(match.group(1)) except Exception as e: - logger.error(f"Failed to read mod path from {mod_descriptor_path}") - logger.error(e) + logger.warn(f"Failed to read mod path from {mod_descriptor_path}") + logger.warn(e) return None def _localization_file_matches_language(file_path: pathlib.Path, language: str): - with open(file_path, "r") as f: + with open(file_path, "r", encoding="utf-8") as f: first_line = f.readline() match = re.match(rf"^\ufeff\s*{language}\s*:\s*$", first_line) return match is not None