perf: 优化代码和错误提示 (#101)
This commit is contained in:
parent
2375b470b0
commit
dfb04b1052
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
|
|
||||||
def get_file_content(path):
|
def get_file_content(path):
|
||||||
file = open(path, "r",
|
with open(path, "r", encoding='utf-8') as file:
|
||||||
encoding='utf-8')
|
content = file.read()
|
||||||
content = file.read()
|
|
||||||
file.close()
|
|
||||||
return content
|
return content
|
||||||
|
|||||||
@ -193,11 +193,11 @@ class ConfigManager:
|
|||||||
if manager.load_from_yml():
|
if manager.load_from_yml():
|
||||||
config = manager.config
|
config = manager.config
|
||||||
else:
|
else:
|
||||||
msg = """
|
msg = f"""
|
||||||
|
|
||||||
Error: No config file found.
|
Error: No config file found.
|
||||||
|
|
||||||
You can run `cp config_example.yml config_example.yml`, and edit it.
|
You can run `cp config_example.yml {root_path}/config_example.yml`, and edit it.
|
||||||
"""
|
"""
|
||||||
raise ImportError(msg)
|
raise ImportError(msg)
|
||||||
return config
|
return config
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user