Generate: don't fail on marked utf-8 files (#399)
utf-8-sig will fallback to non-sig automatically
This commit is contained in:
parent
37d9eb2752
commit
a3e1ac896f
|
@ -217,10 +217,10 @@ def main(args=None, callback=ERmain):
|
||||||
def read_weights_yaml(path):
|
def read_weights_yaml(path):
|
||||||
try:
|
try:
|
||||||
if urllib.parse.urlparse(path).scheme in ('https', 'file'):
|
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:
|
else:
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
yaml = str(f.read(), "utf-8")
|
yaml = str(f.read(), "utf-8-sig")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"Failed to read weights ({path})") from e
|
raise Exception(f"Failed to read weights ({path})") from e
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue