From 8dce96842dcdc0d79c7b4ef4b00613f9f2dfb4e2 Mon Sep 17 00:00:00 2001 From: l3uddz Date: Fri, 20 Apr 2018 22:13:05 +0100 Subject: [PATCH] use realpath from argv[0] (otherwise symlinked default config locations = /usr/bin/local/config.json) --- traktarr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/traktarr.py b/traktarr.py index 9641e89..aaa5c74 100755 --- a/traktarr.py +++ b/traktarr.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import os.path +import sys import time import click @@ -22,7 +23,7 @@ notify = None type=click.Path(file_okay=True, dir_okay=False), help='Configuration file', show_default=True, - default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.json") + default=os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "config.json") ) @click.option( '--logfile', @@ -30,7 +31,7 @@ notify = None type=click.Path(file_okay=True, dir_okay=False), help='Log file', show_default=True, - default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "activity.log") + default=os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "activity.log") ) def app(config, logfile): # Setup global variables