From 042a905c3791e466327764b79748cf26738a4c26 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 13 Feb 2025 17:39:04 -0800 Subject: [PATCH] Open yaml files with utf-8 encoding for extra_model_paths.yaml (#6807) * Using utf-8 encoding for yaml files. * Fix test assertion. --- tests-unit/utils/extra_config_test.py | 2 +- utils/extra_config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests-unit/utils/extra_config_test.py b/tests-unit/utils/extra_config_test.py index b23f5bd08..6d232079e 100644 --- a/tests-unit/utils/extra_config_test.py +++ b/tests-unit/utils/extra_config_test.py @@ -114,7 +114,7 @@ def test_load_extra_model_paths_expands_userpath( mock_yaml_safe_load.assert_called_once() # Check if open was called with the correct file path - mock_file.assert_called_once_with(dummy_yaml_file_name, 'r') + mock_file.assert_called_once_with(dummy_yaml_file_name, 'r', encoding='utf-8') @patch('builtins.open', new_callable=mock_open) diff --git a/utils/extra_config.py b/utils/extra_config.py index d7b592855..b7196e36f 100644 --- a/utils/extra_config.py +++ b/utils/extra_config.py @@ -4,7 +4,7 @@ import folder_paths import logging def load_extra_path_config(yaml_path): - with open(yaml_path, 'r') as stream: + with open(yaml_path, 'r', encoding='utf-8') as stream: config = yaml.safe_load(stream) yaml_dir = os.path.dirname(os.path.abspath(yaml_path)) for c in config: