From a3e1ac896fe6d3d41e504c379445b637631d8fc6 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 3 Apr 2022 21:55:46 +0200 Subject: [PATCH] Generate: don't fail on marked utf-8 files (#399) utf-8-sig will fallback to non-sig automatically --- Generate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Generate.py b/Generate.py index dacaeb75..f934f1a7 100644 --- a/Generate.py +++ b/Generate.py @@ -217,10 +217,10 @@ def main(args=None, callback=ERmain): def read_weights_yaml(path): try: if urllib.parse.urlparse(path).scheme in ('https', 'file'): - yaml = str(urllib.request.urlopen(path).read(), "utf-8") + yaml = str(urllib.request.urlopen(path).read(), "utf-8-sig") else: with open(path, 'rb') as f: - yaml = str(f.read(), "utf-8") + yaml = str(f.read(), "utf-8-sig") except Exception as e: raise Exception(f"Failed to read weights ({path})") from e