summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien <contact@julienpro.com>2023-07-08 23:15:12 +0200
committerJulien <contact@julienpro.com>2023-07-08 23:15:12 +0200
commit552fbd35323cf915ab08e9571e6351804c1f0f63 (patch)
treec14e063b0f1b00d3e163c42354b5ab95ffffab3e
parent96f2538635f55ed7217b714ef504fbbcaa9ccfb0 (diff)
Allow execution from another directory
-rwxr-xr-xlidecli.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lidecli.py b/lidecli.py
index f30c9ed..055519a 100755
--- a/lidecli.py
+++ b/lidecli.py
@@ -54,16 +54,20 @@ def print_commands(args):
def read_temporary_variable(index):
config = configparser.ConfigParser()
- config.read('config.ini')
+ path = os.path.dirname(__file__)
+ config_file = "{}/config.ini".format(path)
+ config.read(config_file)
key = 'TMP_RESULT_'+str(index)
return config['TMP_STORAGE'][key]
def set_temporary_variable(index, value):
config = configparser.ConfigParser()
- config.read('config.ini')
+ path = os.path.dirname(__file__)
+ config_file = "{}/config.ini".format(path)
+ config.read(config_file)
key = 'TMP_RESULT_'+str(index)
config['TMP_STORAGE'][key] = value
- with open('config.ini','w') as configfile:
+ with open(config_file, 'w') as configfile:
config.write(configfile)
def exec_command(args):