From f1a456227a0f9d8cc8448cecfc304f0eb41513de Mon Sep 17 00:00:00 2001 From: acastro Date: Mon, 19 Nov 2018 14:45:50 +0000 Subject: [PATCH] using abs paths --- read-json.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/read-json.py b/read-json.py index ce864d1..6054470 100755 --- a/read-json.py +++ b/read-json.py @@ -3,17 +3,20 @@ import json, random, os from pprint import pprint from time import sleep + # open json files -oracle_f = open("guru.json", "r").read() +pwd = os.path.dirname( os.path.realpath(__file__) ) + "/" +oracle_f = open(pwd + "guru.json", "r").read() oracle = json.loads(oracle_f) -rebel_f = open("rebel.json", "r").read() +rebel_f = open(pwd + "rebel.json", "r").read() rebel = json.loads(rebel_f) + # GURU PART keys = list( oracle.keys()) part = random.choice(keys) # choose: Repeat OR Ask Yourself print(part) -sound_dir = "Audio_recordings/" + oracle[part]['title'] + "/" +sound_dir = pwd + "Audio_recordings/" + oracle[part]['title'] + "/" intro = random.choice(oracle[part]['introductions']) intro_txt = intro[0] intro_sound = sound_dir + intro[1]