Open yaml files with utf-8 encoding for extra_model_paths.yaml (#6807)

* Using utf-8 encoding for yaml files.

* Fix test assertion.
This commit is contained in:
Robin Huang 2025-02-13 17:39:04 -08:00 committed by GitHub
parent 019c7029ea
commit 042a905c37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ def test_load_extra_model_paths_expands_userpath(
mock_yaml_safe_load.assert_called_once() mock_yaml_safe_load.assert_called_once()
# Check if open was called with the correct file path # 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) @patch('builtins.open', new_callable=mock_open)

View File

@ -4,7 +4,7 @@ import folder_paths
import logging import logging
def load_extra_path_config(yaml_path): 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) config = yaml.safe_load(stream)
yaml_dir = os.path.dirname(os.path.abspath(yaml_path)) yaml_dir = os.path.dirname(os.path.abspath(yaml_path))
for c in config: for c in config: