Skip to content

Release 2.0 of paho-mqtt changed signature of mqtt_client.Client #1

@ahrens26

Description

@ahrens26

Running spacemouse.py produces the following error:

$ python spacemouse.py

Traceback (most recent call last):
  File "/home/rich/git/SpaceMouse/python/spacemouse.py", line 114, in <module>
    client = connect_mqtt()
             ^^^^^^^^^^^^^^
  File "/home/rich/git/SpaceMouse/python/spacemouse.py", line 51, in connect_mqtt
    client = mqtt_client.Client(client_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rich/spacemouse/lib/python3.11/site-packages/paho/mqtt/client.py", line 772, in __init__
    raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details

Per this, line 51 should be modified as follows:

client = mqtt_client.Client(mqtt_client.CallbackAPIVersion.VERSION1, client_id)

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