Closed thelizri closed 7 months ago
Thanks for reporting this. The current plan is to accept v1 compatibility and release a minor version increment. Then eventually updating the function signatures inline with https://github.com/eclipse/paho.mqtt.python/pull/802/files and doing a major version change.
A hack that worked for me was to change Adafruit_IO/mqtt_client.py to
> 63c63
> < self._client = mqtt.Client()
> ---
> > self._client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
>
Would not recommend it, but worked for me.
Platform/operating system (i.e. Raspberry Pi with Raspbian operating system, Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): MacOS Sonoma 14.0
Python version (run
python -version
orpython3 -version
): Python 3.11.5Error message you are receiving, including any Python exception traces: Exception ignored in: <function Client.del at 0x10ed92160> Traceback (most recent call last): File "/Users/william/Documents/Internet of Things/wireless_power_transfer/.venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 874, in del self._reset_sockets() File "/Users/william/Documents/Internet of Things/wireless_power_transfer/.venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets self._sock_close() File "/Users/william/Documents/Internet of Things/wireless_power_transfer/.venv/lib/python3.11/site-packages/paho/mqtt/client.py", line 1119, in _sock_close if not self._sock: ^^^^^^^^^^ AttributeError: 'Client' object has no attribute '_sock' Traceback (most recent call last): File "/Users/william/Documents/Internet of Things/wireless_power_transfer/main.py", line 55, in
client = MQTTClient(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/william/Documents/Internet of Things/wireless_power_transfer/.venv/lib/python3.11/site-packages/Adafruit_IO/mqtt_client.py", line 63, in init
self._client = mqtt.Client()
^^^^^^^^^^^^^
TypeError: Client.init() missing 1 required positional argument: 'callback_api_version'
List the steps to reproduce the problem below (if possible attach code or commands to run): I got this problem when running the mqtt_shared_feeds.py example. It appears the Adafruit_IO MQTT_Client is not compliant with the latest update of paho-mqtt. It works if I run an older version of paho-mqtt. For the newer version the constructor needs to be provided an CallbackAPIVersion. For example import paho.mqtt.client as mqtt mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)