From 6d1f323c39a17424d42bcada9b31e3ba39e4c533 Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Wed, 9 Oct 2019 07:12:23 +0100 Subject: [PATCH] #75: Use __file__ to get relative paths --- common/config.py | 3 ++- common/logger_setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/config.py b/common/config.py index ecb2afa5..720f72a1 100644 --- a/common/config.py +++ b/common/config.py @@ -6,7 +6,8 @@ class Config(object): def __init__(self): - with open(Path("config.json")) as target: + config_path = Path(__file__).parent.parent / "config.json" + with open(config_path) as target: self.config = json.load(target) target.close() diff --git a/common/logger_setup.py b/common/logger_setup.py index 55e237f9..7d9e939d 100644 --- a/common/logger_setup.py +++ b/common/logger_setup.py @@ -4,7 +4,7 @@ from common.config import config log_level = "DEBUG" -LOG_FILE_NAME = Path("logs.log") +LOG_FILE_NAME = Path(__file__).parent.parent / "logs.log" logger_config = { "version": 1, "formatters": {"default": {