Skip to content

Python 3.9 Breaks HBMQTT: 'Lock' object is not iterable #223

@ekkizogloy

Description

@ekkizogloy

Python 3.9 changes the way that locks are used. This breaks HBMQTT.
It looks like this change is what causes it:
python/cpython@90d9ba6

Error:

Unhandled exception: 'Lock' object is not iterable
Connection failed: TypeError("'Lock' object is not iterable")

Code to recreate the issue:

import asyncio
from hbmqtt.client import MQTTClient, ClientException
from hbmqtt.mqtt.constants import QOS_1

remote_url = "mqtt://test.mosquitto.org:1883/"
topic = "testtopic/testtest"
msgdata = b'Hello'

async def main():
    b = MQTTClient(config={'keep_alive': 60})
    await b.connect(remote_url)
    while True:
        await asyncio.sleep(5)
        asyncio.create_task(b.publish(topic=topic, message=msgdata, qos=QOS_1))

if __name__ == '__main__':
    asyncio.run(main())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions