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:
Richard Bowman 2022-08-09 07:16:44 +01:00
parent 9b7fba55b6
commit a9fff24848
11 changed files with 16 additions and 15 deletions

View file

@ -31,7 +31,7 @@ def script_directory(path):
def get_meta():
with open(script_directory("metadata.yaml")) as f:
with open(script_directory("metadata.yaml"), encoding="utf-8") as f:
metadata = f.read()
return yaml.safe_load(metadata)
@ -51,7 +51,7 @@ def main():
zenodo.upload_file(deposit["id"], path)
link = deposit["links"]["latest_draft_html"]
with open("zenodo-link.html", "w") as f:
with open("zenodo-link.html", "w", encoding="utf-8") as f:
f.write(f'<a href="{link}">{link}</a>')