From 9b43808395ede59ccd543918179267f4d1c77923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 20 Feb 2024 15:55:03 +0100 Subject: [PATCH] testing out json as list conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/app.py b/server/app.py index b533a48..35d34e4 100644 --- a/server/app.py +++ b/server/app.py @@ -8,7 +8,7 @@ from getmac import get_mac_address import time from multiprocessing import Process, Pipe, Queue from queue import Empty -from ast import literal_eval +import json app = Flask(__name__) @@ -132,7 +132,7 @@ def mqtt_publisher(ti_receiver): print("setting dmxPacket var from artnet data took: "+str(end-start)) if tube_index is not None: start = time.time() - tube_index = eval(tube_index) + tube_index = json.loads(tube_index) end = time.time() print("Converting tube index back to list wtih leval took: "+str(end-start)) for index_row in tube_index: @@ -159,7 +159,7 @@ def tube_index_updater(ti_queue): cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") tube_index = cur.fetchall() cur.close() - ti_queue.put(str(tube_index)) + ti_queue.put(json.dumps(tube_index)) except Exception as e: print(e) time.sleep(5)