From 2160dad717fcd56cb159af795e28f04f03167a28 Mon Sep 17 00:00:00 2001 From: Satwik Date: Thu, 31 Oct 2019 23:50:50 +0530 Subject: [PATCH] Use dynamic path instead of fixed one --- irrelevant/json_generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/irrelevant/json_generator.py b/irrelevant/json_generator.py index 11eab86..c62499a 100644 --- a/irrelevant/json_generator.py +++ b/irrelevant/json_generator.py @@ -18,8 +18,10 @@ Simplifictions and improvements through patches are more than welcome however :) """ import json +import os import pprint -fname = "/Users/300041709/code/self/wtfpython/README.md" + +fpath = os.path.join(os.path.dirname( __file__ ), '..', 'README.md') examples = [] # The globals @@ -250,7 +252,7 @@ def convert_to_notebook(parsed_json): -with open(fname, 'r+', encoding="utf-8") as f: +with open(fpath, 'r+', encoding="utf-8") as f: lines = iter(f.readlines()) line = next(lines) result = []