sbtinstruments / aiomqtt

The idiomatic asyncio MQTT client, wrapped around paho-mqtt
https://sbtinstruments.github.io/aiomqtt
BSD 3-Clause "New" or "Revised" License
392 stars 71 forks source link

Pin Paho to <2.0 #278

Closed spacemanspiff2007 closed 4 months ago

spacemanspiff2007 commented 4 months ago

Paho 2.0 introduced some new mandatory arg to the Client. If this is not set a really obscure attribute error occurs:

Traceback (most recent call last):
  File "/opt/sml2mqtt/venv/lib/python3.9/site-packages/paho/mqtt/client.py", line 874, in __del__
    self._reset_sockets()
  File "/opt/sml2mqtt/venv/lib/python3.9/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._sock_close()
  File "/opt/sml2mqtt/venv/lib/python3.9/site-packages/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'

It's necessary to pin paho to < 2.0 otherwise aiomqtt will not work.

empicano commented 4 months ago

I thought that paho is pinned to >=1.6.0 <2.0.0, or am I understanding the poetry documentation wrong? From the stack trace, it seems to me like the exception is thrown in paho rather than in aiomqtt.

spacemanspiff2007 commented 4 months ago

I am still using 0.16.1 in (yet) another application which pins "paho-mqtt>=1.6.0" and I'm not a poetry user, so I thought paho-mqtt = "^1.6.0" means the same. I just double checked and aiomqtt 2.0.0 does indeed correcly install paho 1.6.1. Sorry - my mistake.