Przeglądaj źródła

filename specification for running as a service

tags/v1.0.0
Dirk Alders 2 lat temu
rodzic
commit
34800bf5d9
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4
    1
      function/db.py

+ 4
- 1
function/db.py Wyświetl plik

@@ -1,5 +1,8 @@
1
+import os
1 2
 import sqlite3
2 3
 
4
+db_file = os.path.join(os.path.dirname(__file__), '..', 'database.db')
5
+
3 6
 
4 7
 def get_gui_radiator_data(topic):
5 8
     return __storage__().get_gui_radiator_data(topic)
@@ -11,7 +14,7 @@ def set_gui_radiator_data(topic, away_mode, summer_mode, user_temperatur_setpoin
11 14
 
12 15
 class __storage__(object):
13 16
     def __init__(self):
14
-        self.conn = sqlite3.connect("database.db")
17
+        self.conn = sqlite3.connect(db_file)
15 18
         self.c = self.conn.cursor()
16 19
         with self.conn:
17 20
             self.c.execute("""CREATE TABLE IF NOT EXISTS gui_radiator (

Ładowanie…
Anuluj
Zapisz