From c2345c82e1816c79609e7fe3018a50b08ead96f3 Mon Sep 17 00:00:00 2001 From: zart Date: Fri, 28 Jun 2024 09:20:37 +0800 Subject: [PATCH] msg MQTT message --- smp_coder/mqtt_smp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smp_coder/mqtt_smp.py b/smp_coder/mqtt_smp.py index 557dff3..0a7e4f3 100644 --- a/smp_coder/mqtt_smp.py +++ b/smp_coder/mqtt_smp.py @@ -16,8 +16,8 @@ def on_connect(client, userdata, flags, rc, properties=None): def on_message(client, userdata, msg): print("收到消息: " + msg.topic + " " + str(msg.payload)) - if not os.path.exists("user.txt"): - with open("user.txt", "a") as f: + if not os.path.exists("smp_coder/user.txt"): + with open("smp_coder/user.txt", "a") as f: f.write(msg.payload.decode("utf-8") + "\n") else: