From a7594b8bd47566061af02c3673a905c941a24693 Mon Sep 17 00:00:00 2001 From: Simon <65854503+StopmotionSimonYT@users.noreply.github.com> Date: Wed, 24 Aug 2022 13:09:13 +0200 Subject: [PATCH 1/2] Added full path check of .config.template.toml --- utils/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/settings.py b/utils/settings.py index 9f1f78b..d2974d5 100755 --- a/utils/settings.py +++ b/utils/settings.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import re from typing import Tuple, Dict - +from pathlib import Path import toml from rich.console import Console @@ -159,4 +159,5 @@ If you see any prompts, that means that you have unset/incorrectly set variables if __name__ == "__main__": - check_toml("utils/.config.template.toml", "config.toml") + directory = Path().absolute() + check_toml(f"{directory}/utils/.config.template.toml", "config.toml") From ba4bd197f9c89a441091921fb112f02ec076b88f Mon Sep 17 00:00:00 2001 From: Simon <65854503+StopmotionSimonYT@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:58:20 +0200 Subject: [PATCH 2/2] Added whole path checker in main.py for config.toml --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 93b4a13..02964fc 100755 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ import sys from os import name from subprocess import Popen +from pathlib import Path from prawcore import ResponseException from reddit.subreddit import get_subreddit_threads @@ -77,7 +78,8 @@ def shutdown(): if __name__ == "__main__": assert sys.version_info >= (3, 9), "Python 3.10 or higher is required" - config = settings.check_toml("utils/.config.template.toml", "config.toml") + directory = Path().absolute() + config = settings.check_toml(f"{directory}/utils/.config.template.toml", "config.toml") config is False and exit() try: if len(config["reddit"]["thread"]["post_id"].split("+")) > 1: