From ec1604d391ebbc14e25c52930e6ccadf3548b171 Mon Sep 17 00:00:00 2001 From: jodth07 Date: Tue, 19 May 2020 20:52:24 -0400 Subject: 5/19 - ext - set upen files encoding to utf8 for bots --- bot/exts/halloween/hacktoberstats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot/exts/halloween/hacktoberstats.py') diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index e01ee50c..d63ce39d 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -123,7 +123,7 @@ class HacktoberStats(commands.Cog): """ if self.link_json.exists(): logging.info(f"Loading linked GitHub accounts from '{self.link_json}'") - with open(self.link_json, 'r') as file: + with open(self.link_json, 'r', encoding="utf8") as file: linked_accounts = json.load(file) logging.info(f"Loaded {len(linked_accounts)} linked GitHub accounts from '{self.link_json}'") -- cgit v1.2.3 From 86dad2173f0a8c6dc5d1d0646ba6441a1517052a Mon Sep 17 00:00:00 2001 From: jodth07 Date: Sun, 24 May 2020 20:04:53 -0400 Subject: 5/24 - bot exts - updated writing with utf8 encoding --- bot/exts/evergreen/branding.py | 2 +- bot/exts/halloween/candy_collection.py | 2 +- bot/exts/halloween/hacktoberstats.py | 2 +- bot/exts/halloween/monstersurvey.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'bot/exts/halloween/hacktoberstats.py') diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 6553830c..7e531011 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -179,7 +179,7 @@ class BrandingManager(commands.Cog): current_config = self._read_config() current_config[key] = value - with self.config_file.open("w") as persistent_file: + with self.config_file.open("w", encoding="utf8") as persistent_file: json.dump(current_config, persistent_file) async def _daemon_func(self) -> None: diff --git a/bot/exts/halloween/candy_collection.py b/bot/exts/halloween/candy_collection.py index 1f79d4e6..2c7d2f23 100644 --- a/bot/exts/halloween/candy_collection.py +++ b/bot/exts/halloween/candy_collection.py @@ -178,7 +178,7 @@ class CandyCollection(commands.Cog): def save_to_json(self) -> None: """Save JSON to a local file.""" - with open(json_location, 'w') as outfile: + with open(json_location, 'w', encoding="utf8") as outfile: json.dump(self.candy_json, outfile) @in_month(Month.OCTOBER) diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index d63ce39d..db5e37f2 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -145,7 +145,7 @@ class HacktoberStats(commands.Cog): } """ logging.info(f"Saving linked_accounts to '{self.link_json}'") - with open(self.link_json, 'w') as file: + with open(self.link_json, 'w', encoding="utf8") as file: json.dump(self.linked_accounts, file, default=str) logging.info(f"linked_accounts saved to '{self.link_json}'") diff --git a/bot/exts/halloween/monstersurvey.py b/bot/exts/halloween/monstersurvey.py index 3b358212..7b1a1e84 100644 --- a/bot/exts/halloween/monstersurvey.py +++ b/bot/exts/halloween/monstersurvey.py @@ -33,7 +33,7 @@ class MonsterSurvey(Cog): def json_write(self) -> None: """Write voting results to a local JSON file.""" log.info("Saved Monster Survey Results") - with open(self.registry_location, 'w') as jason: + with open(self.registry_location, 'w', encoding="utf8") as jason: json.dump(self.voter_registry, jason, indent=2) def cast_vote(self, id: int, monster: str) -> None: -- cgit v1.2.3