I'm trying to call a function in python (using @app.route) from my webpage. However, I keep getting an Error 500 and I cannot figure out why. Here are some relevant code snippets:
server.py: python server. In particular, I am trying to call the "chart" function and this request is returning an error.
from flask import Flask, flash, redirect, render_template, request, session, abort, jsonify
app = Flask(__name__)
# Load Main Page
@app.route("/")
def load_index():
    return render_template('index.html')
# Return Chart Data
@app.route("/chart")
def chart():
    file = open("~/1-1938.csv")
    file_contents = file.readlines()
    info = file_contents[121]
    info = info.split(",")
    for i in range(len(info)):
        info[i] = info[i].strip('"')
    # creating json object
    return jsonify (
        name = info[0],
        mean_temp = int(info[4]),
        high_temp = int(info[6]),
        low_temp = int(info[8])
    )
if __name__ == "__main__":
    try:
        app.run(host='0.0.0.0', port=80)
    except:
        print "Server Crashed :("
Here is the relevant snippets from the index.html:
 // Button Click (Populating Chart Data)
    $("#populate").click(function() {
        $.getJSON($SCRIPT_ROOT + '/chart', function(received_data) {
            config.data.labels=["Jan 1938"];
            config.data.datasets[0].data = [received_data.high_temp];
            config.data.datasets[1].data = [received_data.low_temp];
            config.data.datasets[2].data = [received_data.mean_temp];
            window.myLine.update();
            console.log("Done");
        });
    });
