Skip to content

Commit 058b81a

Browse files
committed
mqtt: Attempt to fix JSON decode on Python 3
1 parent d758f7c commit 058b81a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

msgflo/msgflo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,11 @@ def _on_message(self, client, userdata, mqtt_msg):
327327
def notify():
328328
msg = Message(mqtt_msg.payload)
329329
try:
330-
msg.json = json.loads(str(mqtt_msg.payload))
330+
msg.json = json.loads(mqtt_msg.payload)
331331
msg.data = msg.json # compat
332332
except ValueError as e:
333333
# Not JSON, assume binary
334+
msg.json = e
334335
msg.data = msg.buffer
335336

336337
self.participant.process(port, msg)

0 commit comments

Comments
 (0)