This repository has been archived on 2021-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
D3/D3-Annotator/parser/json_parser.py

41 lines
874 B
Python

#!/bin/python
import sys;
import os;
import json;
import sqlite3;
def main():
print("PROGRAM STARTED");
try:
json_file = open("dwannotator.json", "r");
read_json(json_file);
except:
print("Error loading DB.");
def read_json(json_file):
print("...starting to read .json file.");
input_file = db_file;
document = input_file.read();
json_obj = json.loads(document);
user = json_obj["user"];
print(str(json_obj["user"]));
#feed_database(user);
def feed_database(data):
try:
db_connection = sqlite3.connect('dwannotator.db');
db_cursor = db_connection.cursor();
db_connection.commit();
db_connection.close();
print("Database connection closed.");
except sqlite3.Error as e:
print(" Sqlite error: ", e.args[0]);
if __name__ == "__main__":
main();