### What problem does this PR solve? fix:when start with source code not in docker env report "UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 5: illegal multibyte sequence" in windows ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: tangyu <1@1.com>tags/v0.17.1
| dir = os.path.join(get_project_base_directory(), "agent", "templates") | dir = os.path.join(get_project_base_directory(), "agent", "templates") | ||||
| for fnm in os.listdir(dir): | for fnm in os.listdir(dir): | ||||
| try: | try: | ||||
| cnvs = json.load(open(os.path.join(dir, fnm), "r")) | |||||
| cnvs = json.load(open(os.path.join(dir, fnm), "r",encoding="utf-8")) | |||||
| try: | try: | ||||
| CanvasTemplateService.save(**cnvs) | CanvasTemplateService.save(**cnvs) | ||||
| except Exception: | except Exception: |
| GOODS["cid"] = GOODS["cid"].astype(str) | GOODS["cid"] = GOODS["cid"].astype(str) | ||||
| GOODS = GOODS.set_index(["cid"]) | GOODS = GOODS.set_index(["cid"]) | ||||
| CORP_TKS = json.load( | CORP_TKS = json.load( | ||||
| open(os.path.join(current_file_path, "res/corp.tks.freq.json"), "r") | |||||
| open(os.path.join(current_file_path, "res/corp.tks.freq.json"), "r",encoding="utf-8") | |||||
| ) | ) | ||||
| GOOD_CORP = json.load(open(os.path.join(current_file_path, "res/good_corp.json"), "r")) | |||||
| CORP_TAG = json.load(open(os.path.join(current_file_path, "res/corp_tag.json"), "r")) | |||||
| GOOD_CORP = json.load(open(os.path.join(current_file_path, "res/good_corp.json"), "r",encoding="utf-8")) | |||||
| CORP_TAG = json.load(open(os.path.join(current_file_path, "res/corp_tag.json"), "r",encoding="utf-8")) | |||||
| def baike(cid, default_v=0): | def baike(cid, default_v=0): |
| os.path.join(current_file_path, "res/schools.csv"), sep="\t", header=0 | os.path.join(current_file_path, "res/schools.csv"), sep="\t", header=0 | ||||
| ).fillna("") | ).fillna("") | ||||
| TBL["name_en"] = TBL["name_en"].map(lambda x: x.lower().strip()) | TBL["name_en"] = TBL["name_en"].map(lambda x: x.lower().strip()) | ||||
| GOOD_SCH = json.load(open(os.path.join(current_file_path, "res/good_sch.json"), "r")) | |||||
| GOOD_SCH = json.load(open(os.path.join(current_file_path, "res/good_sch.json"), "r",encoding="utf-8")) | |||||
| GOOD_SCH = set([re.sub(r"[,. &()()]+", "", c) for c in GOOD_SCH]) | GOOD_SCH = set([re.sub(r"[,. &()()]+", "", c) for c in GOOD_SCH]) | ||||