Skip to content

Commit f7eaabf

Browse files
committed
fix: 修复win系统在cmd下执行初始化插件脚本的编码问题
1 parent 7011b75 commit f7eaabf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

plugin_init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ def __update_setting(self, new_setting):
144144
sub_str = 'PLUGIN_PATH = ' + self.__format_setting(final_setting)
145145

146146
setting_path = self.app.config.root_path + '/config/setting.py'
147-
with open(setting_path, 'r') as f:
147+
with open(setting_path, 'r', encoding='UTF-8') as f:
148148
content = f.read()
149149
pattern = 'PLUGIN_PATH = \{([\s\S]*)\}+.*?'
150150
result = re.sub(pattern, sub_str, content)
151151

152-
with open(setting_path, 'w+') as f:
152+
with open(setting_path, 'w+', encoding='UTF-8') as f:
153153
f.write(result)
154154

155155
def __get_all_plugins(self):
@@ -255,7 +255,7 @@ def __generate_plugin_graph(self):
255255
'.', '/').replace('app', '')
256256
requirements_path = self.app.config.root_path + \
257257
plugin_path + '/requirements.txt'
258-
with open(requirements_path, 'r') as f:
258+
with open(requirements_path, 'r', encoding='UTF-8') as f:
259259
while True:
260260

261261
# 正则匹配requirements的每一行的信息

0 commit comments

Comments
 (0)