Generate: don't fail on marked utf-8 files ()

utf-8-sig will fallback to non-sig automatically
This commit is contained in:
Fabian Dill 2022-04-03 21:55:46 +02:00 committed by GitHub
parent 37d9eb2752
commit a3e1ac896f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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