提交 5f46f764 编写于 作者: F feilong

fix script bug

上级 b0859e9b
# -*- coding: utf-8 -*-
from json import load from json import load
from src.tree import TreeWalker, load_json, dump_json from src.tree import TreeWalker, load_json, dump_json
......
# -*- coding: utf-8 -*-
import logging import logging
from genericpath import exists from genericpath import exists
import json import json
...@@ -16,7 +17,7 @@ logger.addHandler(handler) ...@@ -16,7 +17,7 @@ logger.addHandler(handler)
def load_json(p): def load_json(p):
with open(p, 'r') as f: with open(p, 'r', encoding='utf-8') as f:
return json.loads(f.read()) return json.loads(f.read())
...@@ -29,7 +30,7 @@ def dump_json(p, j, exist_ok=False, override=False): ...@@ -29,7 +30,7 @@ def dump_json(p, j, exist_ok=False, override=False):
logger.error(f"{p} already exist") logger.error(f"{p} already exist")
sys.exit(0) sys.exit(0)
with open(p, 'w+') as f: with open(p, 'w+', encoding='utf-8') as f:
f.write(json.dumps(j, indent=2, ensure_ascii=False)) f.write(json.dumps(j, indent=2, ensure_ascii=False))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册