From ad595aae697abbf7c7de79a4a2448f0c47133934 Mon Sep 17 00:00:00 2001 From: Mihnea Dobrescu-Balaur Date: Sat, 21 May 2016 19:36:53 -0700 Subject: [PATCH] Make viewer runnable from outer dirs. --- execution_trace/viewer/viewer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/execution_trace/viewer/viewer.py b/execution_trace/viewer/viewer.py index f54922f..d70cf78 100644 --- a/execution_trace/viewer/viewer.py +++ b/execution_trace/viewer/viewer.py @@ -1,6 +1,7 @@ # Run with `python viewer.py PATH_TO_RECORD_JSON. import json +import os import sys from flask import Flask, jsonify @@ -8,6 +9,8 @@ app = Flask(__name__) +viewer_root = os.path.abspath(os.path.dirname(__file__)) + # `main` inits these. # File containing `record` output. @@ -18,7 +21,7 @@ @app.route("/") def hello(): - return send_from_directory('.', 'index.html') + return send_from_directory(viewer_root, 'index.html') @app.route("/source.json")