From bce66236034830abd2cdd28d5e5fadfa5be94892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 12 Aug 2022 22:07:15 +0200 Subject: [PATCH] fixxed some json stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- pc-client/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pc-client/main.py b/pc-client/main.py index dc8f318..d895030 100644 --- a/pc-client/main.py +++ b/pc-client/main.py @@ -2,6 +2,7 @@ import time import os current_path = os.path.dirname(os.path.realpath(__file__)) import threading +import json try: import pystray from PIL import Image, ImageDraw @@ -25,20 +26,19 @@ def debug_print_error(msg: str): if not os.path.exists(current_path+"/modes.json"): with open(current_path+"/modes.json", "w") as f: - f.write({"mode": 0}) + json.dump({"mode": 0}, f) else: with open(current_path+"/modes.json", "r") as f: global mode - mode = f.read() - + mode = json.load(f)["mode"] #mode switches -def volument_mode(): +def volumen_mode(): debug_print("volument mode") global mode mode = 0 with open(current_path+"/modes.json", "w") as f: - f.write({"mode": 0}) + json.dump({"mode": 0}, f) #mode actions