perf: 优化代码和错误提示 (#101)
This commit is contained in:
parent
2375b470b0
commit
dfb04b1052
@ -9,8 +9,6 @@
|
||||
|
||||
|
||||
def get_file_content(path):
|
||||
file = open(path, "r",
|
||||
encoding='utf-8')
|
||||
content = file.read()
|
||||
file.close()
|
||||
with open(path, "r", encoding='utf-8') as file:
|
||||
content = file.read()
|
||||
return content
|
||||
|
||||
@ -193,11 +193,11 @@ class ConfigManager:
|
||||
if manager.load_from_yml():
|
||||
config = manager.config
|
||||
else:
|
||||
msg = """
|
||||
msg = f"""
|
||||
|
||||
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)
|
||||
return config
|
||||
|
||||
Loading…
Reference in New Issue
Block a user