myDevicesIoT / Cayenne-MQTT-Python

Python Library for Cayenne MQTT API
33 stars 24 forks source link

TypeError on_connect() #4

Closed taufikterdidik closed 7 years ago

taufikterdidik commented 7 years ago

Connecting to mqtt.mydevices.com... Traceback (most recent call last): File "cobaya.py", line 19, in client.loop() File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\cayenne\client.py", line 150, in loop self.client.loop() File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py", line 995, in loop rc = self.loop_read(max_packets) File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py", line 1273, in loop_read rc = self._packet_read() File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py", line 1838, in _packet_read rc = self._packet_handle() File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py", line 2291, in _packet_handle return self._handle_connack() File "C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py", line 2349, in _handle_connack self.on_connect(self, self._userdata, flags_dict, result) TypeError: on_connect() takes 3 positional arguments but 4 were given

I try to manually edit source code C:\Users\taufik\AppData\Local\Programs\Python\Python36\lib\site-packages\paho\mqtt\client.py line 2349, modify from self.on_connect(self, self._userdata, flags_dict, result) to self.on_connect(self, self._userdata, result) and It work!! but I think this is bad idea

sorry, newbie

jburhenn commented 7 years ago

Thanks for reporting this. It looks like it was a compatibility issue with the latest Paho MQTT library. This should now be fixed. You can try it out by updating to version 1.0.1 of the Cayenne MQTT library.