diff options
author | 2023-08-22 14:47:59 +0100 | |
---|---|---|
committer | 2023-08-22 14:47:59 +0100 | |
commit | 37beaa52850831b759f1af519b4f35435ca2ffbb (patch) | |
tree | 5d0157c4336ce1ef1b71f7f1589fee049cafb9d9 | |
parent | Merge pull request #60 from python-discord/bump-various-versions (diff) |
Create Path object once whne loading config
-rw-r--r-- | metricity/config.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/metricity/config.py b/metricity/config.py index 197287e..9dec9af 100644 --- a/metricity/config.py +++ b/metricity/config.py @@ -25,10 +25,11 @@ def get_section(section: str) -> dict[str, Any]: and override that of config-default.toml. """ # Load default configuration - if not Path("config-default.toml").exists(): + default_config_file = Path("config-default.toml") + if not default_config_file.exists(): raise MetricityConfigurationError("config-default.toml is missing") - with Path.open("config-default.toml") as default_config_file: + with default_config_file.open() as default_config_file: default_config = toml.load(default_config_file) # Load user configuration |