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: