bugfix: invalid layout

bugfix: scanner.py for CP949
update DB
This commit is contained in:
Dr.Lt.Data
2023-07-01 09:31:35 +09:00
parent fc68b10bb3
commit 0bc9c5e4b4
4 changed files with 30 additions and 5 deletions

View File

@@ -6,8 +6,12 @@ from torchvision.datasets.utils import download_url
def scan_in_file(filename):
with open(filename, "r") as file:
code = file.read()
try:
with open(filename, encoding='utf-8') as file:
code = file.read()
except UnicodeDecodeError:
with open(filename, encoding='cp949') as file:
code = file.read()
pattern = r"NODE_CLASS_MAPPINGS\s*=\s*{([^}]*)}"
regex = re.compile(pattern, re.MULTILINE | re.DOTALL)