From 2f534168a54323f02d739e73638ca558d1998d12 Mon Sep 17 00:00:00 2001 From: francisco souza <108725+fsouza@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:33:57 -0400 Subject: [PATCH] Always set encoding when reading `setup.cfg` This should fix an issue on Window where the `setup.cfg` can contain non-ascii characters, and Python is trying to use cp1252. This should be safe as utf-8 is compatible with cp1252. It's possible I'll eat my words and some other platform breaks with this change, but let's try. Closes #294. --- autoflake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoflake.py b/autoflake.py index 0581d40..34c3282 100755 --- a/autoflake.py +++ b/autoflake.py @@ -1209,7 +1209,7 @@ def process_config_file(config_file_path: str) -> MutableMapping[str, Any] | Non import configparser reader = configparser.ConfigParser() - reader.read(config_file_path) + reader.read(config_file_path, encoding="utf-8") if not reader.has_section("autoflake"): return None