mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Generate: don't fail on marked utf-8 files (#399)
utf-8-sig will fallback to non-sig automatically
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user