From b090a0035132aaaaedf90b1124c63589f4e1d7d9 Mon Sep 17 00:00:00 2001 From: zart Date: Fri, 28 Jun 2024 09:42:01 +0800 Subject: [PATCH] msg MQTT message --- edu_coder/extur_edu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/edu_coder/extur_edu.py b/edu_coder/extur_edu.py index 046176c..b602a8a 100644 --- a/edu_coder/extur_edu.py +++ b/edu_coder/extur_edu.py @@ -38,8 +38,10 @@ def on_message(client, userdata, msg): response_received = True -# 创建客户端实例 -client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2,) +try: + client = mqtt.Client() +except: + client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2,) # 设置回调函数 client.on_connect = on_connect