summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.py5
-rw-r--r--sql.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/main.py b/main.py
index 22cdbbf..f6bbb23 100644
--- a/main.py
+++ b/main.py
@@ -75,10 +75,13 @@ def export_choice():
def export(opt):
# Defensive handling of input
if opt in ["temperature", "weather", "history", "schedule"]:
- data = db.exec("select * from {}".format(opt))
+ con = sqlite3.connect(self.dbfile)
+ cur = con.cursor()
+ data = cur.exec("select * from {}".format(opt))
o = ""
for i in data:
o += str(a) + "\n"
+ con.close()
return o
else:
return render_template(
diff --git a/sql.py b/sql.py
index 7d14a06..599488f 100644
--- a/sql.py
+++ b/sql.py
@@ -19,9 +19,9 @@ class db:
con = sqlite3.connect(self.dbfile)
cur = con.cursor()
if param == None:
- o = cur.execute(cmd)
+ cur.execute(cmd)
else:
- o = cur.execute(cmd, param)
+ cur.execute(cmd, param)
con.commit()
con.close()
return o