Explicitly specify encoding
The update to pylint means we were failing because open() doesn't specify the encoding everywhere. I have now specified utf-8 everywhere. This was patchy before, and is default behaviour on the Pi. There's a slim chance it will cause some issues on Windows, but that shouldn't affect anyone outside the developers. I've also ignored a couple of new spurious warnings, and explicitly ignored some unused variables.
This commit is contained in:
parent
9b7fba55b6
commit
a9fff24848
11 changed files with 16 additions and 15 deletions
|
|
@ -88,7 +88,7 @@ def load_json_file(config_path) -> dict:
|
|||
|
||||
logging.info("Loading %s...", config_path)
|
||||
|
||||
with open(config_path) as config_file:
|
||||
with open(config_path, encoding="utf-8") as config_file:
|
||||
try:
|
||||
config_data = json.load(config_file)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
|
|
@ -112,7 +112,7 @@ def save_json_file(config_path: str, config_dict: dict):
|
|||
logging.info("Saving %s...", config_path)
|
||||
logging.debug(config_dict)
|
||||
|
||||
with open(config_path, "w") as outfile:
|
||||
with open(config_path, "w", encoding="utf-8") as outfile:
|
||||
json.dump(config_dict, outfile, cls=JSONEncoder, indent=2, sort_keys=True)
|
||||
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ def initialise_file(config_path, populate: str = "{}\n"):
|
|||
create_file(config_path)
|
||||
|
||||
logging.info("Populating %s...", (config_path))
|
||||
with open(config_path, "w") as outfile:
|
||||
with open(config_path, "w", encoding="utf-8") as outfile:
|
||||
outfile.write(populate)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue